Could you please clarify what do you mean here:
Thread.sleep(2000 + scala.util.Random.nextInt(1000)) //????
system.scheduler.scheduleOnce could be used too, but worker Actor can block
The 'worker Actor' won't block in terms of thread block. It will simply be
delayed by the scheduler while the containing Actor finishes, thus
releasing the worker thread to be reassigned to other tasks in waiting. Am
I missing something from your comment? If not, then why couldn't this be
implemented similar to what you did on line 27?
On Thu, Jan 23, 2014 at 1:03 AM, Andy C <[email protected]> wrote:
> Hi,
>
> As a first Akka and Actors exercise, I decided to write a small juggler
> simulator, It basically models a person throwing balls in the air, catching
> them and re-throwing until certain counts are reached.
>
> The code is here
> https://github.com/andycoolware/juggler/blob/master/src/main/scala/demo/Juggler.scalaand
> it seems to run very well. In fact I am amazed how little effort it
> took to make it happen.
>
> The biggest struggle was finding out how to simulate passing time. I used
> Thread.sleep at one point and scheduleOnce. I know Thread.sleep should not
> be used in Actors - it was just for sake of experimentation, as it seems it
> is okay for certain types of Actors.
>
> I would like ask if you see any apparent issues with the code. Would
> appreciate any feedback.
>
> Thanks in advance,
> Andy
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.