- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Beginning with Actors.
Wed, 2012-01-18, 07:37
Deear all,
I need to use actors in the Java "Callable" way...meaning I have to submit two independent computations in Parallel....and synchronize on the completion or the timeout of the two operations...
Can you point me to a resource where I can see how to implement this with actors?
Thank you very much
Best Regards
Edmondo
I need to use actors in the Java "Callable" way...meaning I have to submit two independent computations in Parallel....and synchronize on the completion or the timeout of the two operations...
Can you point me to a resource where I can see how to implement this with actors?
Thank you very much
Best Regards
Edmondo
Wed, 2012-01-18, 08:11
#2
R: Re: Beginning with Actors.
Dear scala users,
I heard scala actors will be replaced by akka actors... Should I already code using akka actors instead?? How is the thread pool backing the actors in the example managed?
Best regards
EdmondoInviato da BlackBerry(R) Wireless HandheldFrom: IL <iron9light@gmail.com> Sender: scala-user@googlegroups.com Date: Tue, 17 Jan 2012 22:51:09 -0800 (PST)To: <scala-user@googlegroups.com>ReplyTo: scala-user@googlegroups.com Subject: [scala-user] Re: Beginning with Actors.
import scala.actors.Actor._
val me = selfreactor { val result = ... me ! result}
reactor { val result = ... me ! result}
val result1 = receive { case x => x}
val result2 = receive { case x => x}
I heard scala actors will be replaced by akka actors... Should I already code using akka actors instead?? How is the thread pool backing the actors in the example managed?
Best regards
EdmondoInviato da BlackBerry(R) Wireless HandheldFrom: IL <iron9light@gmail.com> Sender: scala-user@googlegroups.com Date: Tue, 17 Jan 2012 22:51:09 -0800 (PST)To: <scala-user@googlegroups.com>ReplyTo: scala-user@googlegroups.com Subject: [scala-user] Re: Beginning with Actors.
import scala.actors.Actor._
val me = selfreactor { val result = ... me ! result}
reactor { val result = ... me ! result}
val result1 = receive { case x => x}
val result2 = receive { case x => x}
Wed, 2012-01-18, 10:11
#3
Re: Beginning with Actors.
If it needs to execute in parallel then why use actors and not regular Executors?The actor model is specifically designed for serial execution.
On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
Deear all,
I need to use actors in the Java "Callable" way...meaning I have to submit two independent computations in Parallel....and synchronize on the completion or the timeout of the two operations...
Can you point me to a resource where I can see how to implement this with actors?
Thank you very much
Best Regards
Edmondo
Wed, 2012-01-18, 10:21
#4
Re: Beginning with Actors.
That was my question... :)
Best Regards
2012/1/18 Naftoli Gugenheim <naftoligug@gmail.com>
Best Regards
2012/1/18 Naftoli Gugenheim <naftoligug@gmail.com>
If it needs to execute in parallel then why use actors and not regular Executors?The actor model is specifically designed for serial execution.
On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
Deear all,
I need to use actors in the Java "Callable" way...meaning I have to submit two independent computations in Parallel....and synchronize on the completion or the timeout of the two operations...
Can you point me to a resource where I can see how to implement this with actors?
Thank you very much
Best Regards
Edmondo
Wed, 2012-01-18, 11:01
#5
Re: Beginning with Actors.
On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
If it needs to execute in parallel then why use actors and not regular Executors?
I'd suggest using Future composition instead.
The actor model is specifically designed for serial execution.
No.
On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
Deear all,
I need to use actors in the Java "Callable" way...meaning I have to submit two independent computations in Parallel....and synchronize on the completion or the timeout of the two operations...
Can you point me to a resource where I can see how to implement this with actors?
Thank you very much
Best Regards
Edmondo
--
Viktor Klang
Akka Tech LeadTypesafe - The software stack for applications that scale
Twitter: @viktorklang
Wed, 2012-01-18, 11:11
#6
Re: Beginning with Actors.
Would be great if you could provide a little bit more details...Thank youBest Regards
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
If it needs to execute in parallel then why use actors and not regular Executors?
I'd suggest using Future composition instead.
The actor model is specifically designed for serial execution.
No.
On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
Deear all,
I need to use actors in the Java "Callable" way...meaning I have to submit two independent computations in Parallel....and synchronize on the completion or the timeout of the two operations...
Can you point me to a resource where I can see how to implement this with actors?
Thank you very much
Best Regards
Edmondo
--
Viktor Klang
Akka Tech LeadTypesafe - The software stack for applications that scale
Twitter: @viktorklang
Wed, 2012-01-18, 11:21
#7
Re: Beginning with Actors.
2012/1/18 Edmondo Porcu <edmondo.porcu@gmail.com>
Would be great if you could provide a little bit more details...Thank you
*sprinkles details*
I'll gladly answer questions, but be a bit more specific please.
Cheers,
√
Best Regards
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
If it needs to execute in parallel then why use actors and not regular Executors?
I'd suggest using Future composition instead.
The actor model is specifically designed for serial execution.
No.
On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
Deear all,
I need to use actors in the Java "Callable" way...meaning I have to submit two independent computations in Parallel....and synchronize on the completion or the timeout of the two operations...
Can you point me to a resource where I can see how to implement this with actors?
Thank you very much
Best Regards
Edmondo
--
Viktor Klang
Akka Tech LeadTypesafe - The software stack for applications that scale
Twitter: @viktorklang
--
Viktor Klang
Akka Tech LeadTypesafe - The software stack for applications that scale
Twitter: @viktorklang
Wed, 2012-01-18, 11:31
#8
Re: Beginning with Actors.
Edmondo
If you're looking for a general introduction and explanation of
concepts, the Artima Actors in Scala book is a good starting point
2012/1/18 √iktor Ҡlang :
>
>
> 2012/1/18 Edmondo Porcu
>>
>> Would be great if you could provide a little bit more details...Thank you
>
>
> *sprinkles details*
>
> I'll gladly answer questions, but be a bit more specific please.
>
> Cheers,
> √
>
>>
>> Best Regards
>>
>>
>> 2012/1/18 √iktor Ҡlang
>>>
>>>
>>>
>>> On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim
>>> wrote:
>>>>
>>>> If it needs to execute in parallel then why use actors and not regular
>>>> Executors?
>>>
>>>
>>> I'd suggest using Future composition instead.
>>>
>>>>
>>>> The actor model is specifically designed for serial execution.
>>>
>>>
>>> No.
>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu
>>>> wrote:
>>>>>
>>>>> Deear all,
>>>>> I need to use actors in the Java "Callable" way...meaning I have to
>>>>> submit two independent computations in Parallel....and synchronize on the
>>>>> completion or the timeout of the two operations...
>>>>>
>>>>> Can you point me to a resource where I can see how to implement this
>>>>> with actors?
>>>>>
>>>>> Thank you very much
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Edmondo
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Viktor Klang
>>>
>>> Akka Tech Lead
>>> Typesafe - The software stack for applications that scale
>>>
>>> Twitter: @viktorklang
>>>
>>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - The software stack for applications that scale
>
> Twitter: @viktorklang
>
Wed, 2012-01-18, 11:41
#9
Re: Beginning with Actors.
Thank you all for your interest.
Let me rephrase my questions in a different way:
1) Viktor, what you do suggest is to create for example a class containing a given number of futures and collect their resuls. I know how to do it through a synchronizer, using for example a CountDownLatch . I guess there is a better solution in Java to launch a given number of parallel processing and collect their results.
2) Tim, Actors in Scala is definitely on my list. I am only slightly confused on these two points:
- Actors simplify the execution of parallel, interdependent tasks because they replace shared data structures with immutable message passing. Is there a reason to prefer actors to java executors when the tasks are independent?
- I have read that scala.Actors will be dropped in Scala 2.10 and only Akka actors will be included. What is the difference between them?
Thank you as usualBest Regards
Edmondo Porcu
2012/1/18 Tim Pigden <tim.pigden@optrak.com>
Let me rephrase my questions in a different way:
1) Viktor, what you do suggest is to create for example a class containing a given number of futures and collect their resuls. I know how to do it through a synchronizer, using for example a CountDownLatch . I guess there is a better solution in Java to launch a given number of parallel processing and collect their results.
2) Tim, Actors in Scala is definitely on my list. I am only slightly confused on these two points:
- Actors simplify the execution of parallel, interdependent tasks because they replace shared data structures with immutable message passing. Is there a reason to prefer actors to java executors when the tasks are independent?
- I have read that scala.Actors will be dropped in Scala 2.10 and only Akka actors will be included. What is the difference between them?
Thank you as usualBest Regards
Edmondo Porcu
2012/1/18 Tim Pigden <tim.pigden@optrak.com>
Edmondo
If you're looking for a general introduction and explanation of
concepts, the Artima Actors in Scala book is a good starting point
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>:
>
>
> 2012/1/18 Edmondo Porcu <edmondo.porcu@gmail.com>
>>
>> Would be great if you could provide a little bit more details...Thank you
>
>
> *sprinkles details*
>
> I'll gladly answer questions, but be a bit more specific please.
>
> Cheers,
> √
>
>>
>> Best Regards
>>
>>
>> 2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
>>>
>>>
>>>
>>> On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim
>>> <naftoligug@gmail.com> wrote:
>>>>
>>>> If it needs to execute in parallel then why use actors and not regular
>>>> Executors?
>>>
>>>
>>> I'd suggest using Future composition instead.
>>>
>>>>
>>>> The actor model is specifically designed for serial execution.
>>>
>>>
>>> No.
>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com>
>>>> wrote:
>>>>>
>>>>> Deear all,
>>>>> I need to use actors in the Java "Callable" way...meaning I have to
>>>>> submit two independent computations in Parallel....and synchronize on the
>>>>> completion or the timeout of the two operations...
>>>>>
>>>>> Can you point me to a resource where I can see how to implement this
>>>>> with actors?
>>>>>
>>>>> Thank you very much
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Edmondo
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Viktor Klang
>>>
>>> Akka Tech Lead
>>> Typesafe - The software stack for applications that scale
>>>
>>> Twitter: @viktorklang
>>>
>>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - The software stack for applications that scale
>
> Twitter: @viktorklang
>
--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in
England and Wales.
Company Registration No. 2327613 Registered Offices: Orland House,
Mead Lane, Hertford, SG13 7AT England
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is addressed.
Any views or opinions expressed are solely those of the author and do
not necessarily represent those of Optrak Distribution Software Ltd.
If you are not the intended recipient of this email, you must neither
take any action based upon its contents, nor copy or show it to
anyone. Please contact the sender if you believe you have received
this email in error.
Wed, 2012-01-18, 11:51
#10
Re: Beginning with Actors.
On Wed, Jan 18, 2012 at 11:36 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
Thank you all for your interest.
Let me rephrase my questions in a different way:
1) Viktor, what you do suggest is to create for example a class containing a given number of futures and collect their resuls. I know how to do it through a synchronizer, using for example a CountDownLatch . I guess there is a better solution in Java to launch a given number of parallel processing and collect their results.
http://akka.io/docs/akka/2.0-M2/scala/futures.html#composing-futures
implicit val e = ExecutionContext.fromExecutor(yourExecutorGoesHere)
val futures = for (i ← 1 to 1000) yield Future(i * 2) // Create a sequence of Futures val futureSum = Future.fold(futures)(0)(_ + _) Await.result(futureSum, 1 second) must be(1001000)
2) Tim, Actors in Scala is definitely on my list. I am only slightly confused on these two points:
- Actors simplify the execution of parallel, interdependent tasks because they replace shared data structures with immutable message passing. Is there a reason to prefer actors to java executors when the tasks are independent?
Depends on how you want to handle the results of the tasks. Also, I'm assuming you meant "independent" and not "interdependent".
- I have read that scala.Actors will be dropped in Scala 2.10 and only Akka actors will be included. What is the difference between them?
Everything except the foundation, which is the Actor Model.
Cheers,
√
Thank you as usualBest Regards
Edmondo Porcu
2012/1/18 Tim Pigden <tim.pigden@optrak.com>
Edmondo
If you're looking for a general introduction and explanation of
concepts, the Artima Actors in Scala book is a good starting point
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>:
>
>
> 2012/1/18 Edmondo Porcu <edmondo.porcu@gmail.com>
>>
>> Would be great if you could provide a little bit more details...Thank you
>
>
> *sprinkles details*
>
> I'll gladly answer questions, but be a bit more specific please.
>
> Cheers,
> √
>
>>
>> Best Regards
>>
>>
>> 2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
>>>
>>>
>>>
>>> On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim
>>> <naftoligug@gmail.com> wrote:
>>>>
>>>> If it needs to execute in parallel then why use actors and not regular
>>>> Executors?
>>>
>>>
>>> I'd suggest using Future composition instead.
>>>
>>>>
>>>> The actor model is specifically designed for serial execution.
>>>
>>>
>>> No.
>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com>
>>>> wrote:
>>>>>
>>>>> Deear all,
>>>>> I need to use actors in the Java "Callable" way...meaning I have to
>>>>> submit two independent computations in Parallel....and synchronize on the
>>>>> completion or the timeout of the two operations...
>>>>>
>>>>> Can you point me to a resource where I can see how to implement this
>>>>> with actors?
>>>>>
>>>>> Thank you very much
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Edmondo
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Viktor Klang
>>>
>>> Akka Tech Lead
>>> Typesafe - The software stack for applications that scale
>>>
>>> Twitter: @viktorklang
>>>
>>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - The software stack for applications that scale
>
> Twitter: @viktorklang
>
--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in
England and Wales.
Company Registration No. 2327613 Registered Offices: Orland House,
Mead Lane, Hertford, SG13 7AT England
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is addressed.
Any views or opinions expressed are solely those of the author and do
not necessarily represent those of Optrak Distribution Software Ltd.
If you are not the intended recipient of this email, you must neither
take any action based upon its contents, nor copy or show it to
anyone. Please contact the sender if you believe you have received
this email in error.
--
Viktor Klang
Akka Tech LeadTypesafe - The software stack for applications that scale
Twitter: @viktorklang
Wed, 2012-01-18, 12:01
#11
Re: Beginning with Actors.
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
On Wed, Jan 18, 2012 at 11:36 AM, Edmondo Porcu <edmondo.porcu@gmail.com> wrote:
Thank you all for your interest.
Let me rephrase my questions in a different way:
1) Viktor, what you do suggest is to create for example a class containing a given number of futures and collect their resuls. I know how to do it through a synchronizer, using for example a CountDownLatch . I guess there is a better solution in Java to launch a given number of parallel processing and collect their results.
http://akka.io/docs/akka/2.0-M2/scala/futures.html#composing-futures
implicit val e = ExecutionContext.fromExecutor(yourExecutorGoesHere)
val futures = for (i ← 1 to 1000) yield Future(i * 2) // Create a sequence of Futures val futureSum = Future.fold(futures)(0)(_ + _) Await.result(futureSum, 1 second) must be(1001000)
2) Tim, Actors in Scala is definitely on my list. I am only slightly confused on these two points:
- Actors simplify the execution of parallel, interdependent tasks because they replace shared data structures with immutable message passing. Is there a reason to prefer actors to java executors when the tasks are independent?
Depends on how you want to handle the results of the tasks. Also, I'm assuming you meant "independent" and not "interdependent".
- I have read that scala.Actors will be dropped in Scala 2.10 and only Akka actors will be included. What is the difference between them?
Everything except the foundation, which is the Actor Model.
But the main features of Akka, which Scala Actors doesn't have is:
* ActorRefs
* High performance
* Hierarchical enforced parental supervision
Cheers,
√
Thank you as usualBest Regards
Edmondo Porcu
2012/1/18 Tim Pigden <tim.pigden@optrak.com>
Edmondo
If you're looking for a general introduction and explanation of
concepts, the Artima Actors in Scala book is a good starting point
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>:
>
>
> 2012/1/18 Edmondo Porcu <edmondo.porcu@gmail.com>
>>
>> Would be great if you could provide a little bit more details...Thank you
>
>
> *sprinkles details*
>
> I'll gladly answer questions, but be a bit more specific please.
>
> Cheers,
> √
>
>>
>> Best Regards
>>
>>
>> 2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
>>>
>>>
>>>
>>> On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim
>>> <naftoligug@gmail.com> wrote:
>>>>
>>>> If it needs to execute in parallel then why use actors and not regular
>>>> Executors?
>>>
>>>
>>> I'd suggest using Future composition instead.
>>>
>>>>
>>>> The actor model is specifically designed for serial execution.
>>>
>>>
>>> No.
>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com>
>>>> wrote:
>>>>>
>>>>> Deear all,
>>>>> I need to use actors in the Java "Callable" way...meaning I have to
>>>>> submit two independent computations in Parallel....and synchronize on the
>>>>> completion or the timeout of the two operations...
>>>>>
>>>>> Can you point me to a resource where I can see how to implement this
>>>>> with actors?
>>>>>
>>>>> Thank you very much
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Edmondo
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Viktor Klang
>>>
>>> Akka Tech Lead
>>> Typesafe - The software stack for applications that scale
>>>
>>> Twitter: @viktorklang
>>>
>>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - The software stack for applications that scale
>
> Twitter: @viktorklang
>
--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in
England and Wales.
Company Registration No. 2327613 Registered Offices: Orland House,
Mead Lane, Hertford, SG13 7AT England
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is addressed.
Any views or opinions expressed are solely those of the author and do
not necessarily represent those of Optrak Distribution Software Ltd.
If you are not the intended recipient of this email, you must neither
take any action based upon its contents, nor copy or show it to
anyone. Please contact the sender if you believe you have received
this email in error.
--
Viktor Klang
Akka Tech LeadTypesafe - The software stack for applications that scale
Twitter: @viktorklang
--
Viktor Klang
Akka Tech LeadTypesafe - The software stack for applications that scale
Twitter: @viktorklang
Wed, 2012-01-18, 12:31
#12
Re: Beginning with Actors.
Two more choices:
1 Fork / Join
2 Scala parallel collection
On Wednesday, January 18, 2012 6:36:21 PM UTC+8, edmondo1984 wrote:
1 Fork / Join
2 Scala parallel collection
On Wednesday, January 18, 2012 6:36:21 PM UTC+8, edmondo1984 wrote:
Thank you all for your interest.
Let me rephrase my questions in a different way:
1) Viktor, what you do suggest is to create for example a class containing a given number of futures and collect their resuls. I know how to do it through a synchronizer, using for example a CountDownLatch . I guess there is a better solution in Java to launch a given number of parallel processing and collect their results.
2) Tim, Actors in Scala is definitely on my list. I am only slightly confused on these two points:
- Actors simplify the execution of parallel, interdependent tasks because they replace shared data structures with immutable message passing. Is there a reason to prefer actors to java executors when the tasks are independent?
- I have read that scala.Actors will be dropped in Scala 2.10 and only Akka actors will be included. What is the difference between them?
Thank you as usualBest Regards
Edmondo Porcu
2012/1/18 Tim Pigden <tim.p...@optrak.com>Edmondo
If you're looking for a general introduction and explanation of
concepts, the Artima Actors in Scala book is a good starting point
2012/1/18 √iktor Ҡlang <viktor...@gmail.com>:
>
>
> 2012/1/18 Edmondo Porcu <edmond...@gmail.com>
>>
>> Would be great if you could provide a little bit more details...Thank you
>
>
> *sprinkles details*
>
> I'll gladly answer questions, but be a bit more specific please.
>
> Cheers,
> √
>
>>
>> Best Regards
>>
>>
>> 2012/1/18 √iktor Ҡlang <viktor...@gmail.com>
>>>
>>>
>>>
>>> On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim
>>> <nafto...@gmail.com> wrote:
>>>>
>>>> If it needs to execute in parallel then why use actors and not regular
>>>> Executors?
>>>
>>>
>>> I'd suggest using Future composition instead.
>>>
>>>>
>>>> The actor model is specifically designed for serial execution.
>>>
>>>
>>> No.
>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmond...@gmail.com>
>>>> wrote:
>>>>>
>>>>> Deear all,
>>>>> I need to use actors in the Java "Callable" way...meaning I have to
>>>>> submit two independent computations in Parallel....and synchronize on the
>>>>> completion or the timeout of the two operations...
>>>>>
>>>>> Can you point me to a resource where I can see how to implement this
>>>>> with actors?
>>>>>
>>>>> Thank you very much
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Edmondo
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Viktor Klang
>>>
>>> Akka Tech Lead
>>> Typesafe - The software stack for applications that scale
>>>
>>> Twitter: @viktorklang
>>>
>>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - The software stack for applications that scale
>
> Twitter: @viktorklang
>
--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in
England and Wales.
Company Registration No. 2327613 Registered Offices: Orland House,
Mead Lane, Hertford, SG13 7AT England
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is addressed.
Any views or opinions expressed are solely those of the author and do
not necessarily represent those of Optrak Distribution Software Ltd.
If you are not the intended recipient of this email, you must neither
take any action based upon its contents, nor copy or show it to
anyone. Please contact the sender if you believe you have received
this email in error.
Wed, 2012-01-18, 20:31
#13
Re: Beginning with Actors.
On Jan 18, 2012, at 11:36 AM, Edmondo Porcu wrote:
Of course, scala.actors will go through the regular deprecation cycle first, so they will definitely be included in Scala 2.10.
Some features that currently only Akka actors have will be added to scala.actors to make the migration easier. One example is ActorRefs that Viktor mentioned. In general, we are working on migration support for transitioning from scala.actors to Akka actors. More details should soon be available.
Otherwise, the book "Actors in Scala" also has a chapter on Akka actors, so it provides an introduction to both implementations.
Cheers, Philipp
-- Co-author, "Actors in Scala" (Artima Inc, 2011) Postdoc, EPFL and Stanford University
2) Tim, Actors in Scala is definitely on my list. I am only slightly confused on these two points:
- Actors simplify the execution of parallel, interdependent tasks because they replace shared data structures with immutable message passing. Is there a reason to prefer actors to java executors when the tasks are independent?
- I have read that scala.Actors will be dropped in Scala 2.10 and only Akka actors will be included. What is the difference between them?
Of course, scala.actors will go through the regular deprecation cycle first, so they will definitely be included in Scala 2.10.
Some features that currently only Akka actors have will be added to scala.actors to make the migration easier. One example is ActorRefs that Viktor mentioned. In general, we are working on migration support for transitioning from scala.actors to Akka actors. More details should soon be available.
Otherwise, the book "Actors in Scala" also has a chapter on Akka actors, so it provides an introduction to both implementations.
Cheers, Philipp
2012/1/18 Tim Pigden <tim.pigden@optrak.com>
Edmondo
If you're looking for a general introduction and explanation of
concepts, the Artima Actors in Scala book is a good starting point
2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>:
>
>
> 2012/1/18 Edmondo Porcu <edmondo.porcu@gmail.com>
>>
>> Would be great if you could provide a little bit more details...Thank you
>
>
> *sprinkles details*
>
> I'll gladly answer questions, but be a bit more specific please.
>
> Cheers,
> √
>
>>
>> Best Regards
>>
>>
>> 2012/1/18 √iktor Ҡlang <viktor.klang@gmail.com>
>>>
>>>
>>>
>>> On Wed, Jan 18, 2012 at 10:04 AM, Naftoli Gugenheim
>>> <naftoligug@gmail.com> wrote:
>>>>
>>>> If it needs to execute in parallel then why use actors and not regular
>>>> Executors?
>>>
>>>
>>> I'd suggest using Future composition instead.
>>>
>>>>
>>>> The actor model is specifically designed for serial execution.
>>>
>>>
>>> No.
>>>
>>>>
>>>>
>>>>
>>>> On Wed, Jan 18, 2012 at 1:37 AM, Edmondo Porcu <edmondo.porcu@gmail.com>
>>>> wrote:
>>>>>
>>>>> Deear all,
>>>>> I need to use actors in the Java "Callable" way...meaning I have to
>>>>> submit two independent computations in Parallel....and synchronize on the
>>>>> completion or the timeout of the two operations...
>>>>>
>>>>> Can you point me to a resource where I can see how to implement this
>>>>> with actors?
>>>>>
>>>>> Thank you very much
>>>>>
>>>>> Best Regards
>>>>>
>>>>> Edmondo
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Viktor Klang
>>>
>>> Akka Tech Lead
>>> Typesafe - The software stack for applications that scale
>>>
>>> Twitter: @viktorklang
>>>
>>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - The software stack for applications that scale
>
> Twitter: @viktorklang
>
--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in
England and Wales.
Company Registration No. 2327613 Registered Offices: Orland House,
Mead Lane, Hertford, SG13 7AT England
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is addressed.
Any views or opinions expressed are solely those of the author and do
not necessarily represent those of Optrak Distribution Software Ltd.
If you are not the intended recipient of this email, you must neither
take any action based upon its contents, nor copy or show it to
anyone. Please contact the sender if you believe you have received
this email in error.
-- Co-author, "Actors in Scala" (Artima Inc, 2011) Postdoc, EPFL and Stanford University
val me = selfreactor { val result = ... me ! result}
reactor { val result = ... me ! result}
val result1 = receive { case x => x}
val result2 = receive { case x => x}