Thanks for the excellent suggestions. Very much appreciated.
btw: Under the hoods, the scheduleOnce alternative is quite different from the become/unbecome - where the latter, I presume, would unbecome on ReceiveTimeout.
On Mon, Jan 14, 2013 at 5:33 PM, G J <oda...@gmail.com> wrote:Thanks for the excellent suggestions. Very much appreciated.
btw: Under the hoods, the scheduleOnce alternative is quite different from the become/unbecome - where the latter, I presume, would unbecome on ReceiveTimeout.HiYou're welcome. :)By the way, I don't think of scheduleOnce and become/unbecome as separate alternatives. Roland Kuhn's example (if you look carefully) actually combines both scheduleOnce and become/unbecome in a single program. Let me explain what I mean:1. The actor uses scheduleOnce to schedule a WakeUp message.2. It then uses become to change its behaviour. Its new behaviour is that it waits for a WakeUp message.
3. Once the WakeUp message is receveived it uses unbecome to return the actor to its previous behaviour. The WakeUp message is sent by the scheduler.Notice also that the unbecome is triggered by the scheduled message. I don't think it is a ReceiveTimeout that triggers the unbecome.CheersRich
--
Hi every body!
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Please let me see if I understand your answer correctly, do you mean that if I use thread.sleep(5000) inside an actor, the actor does not leave it's thread at all? and the thread is idle and jobless for 5 seconds?
Do you actually want to use CPU or other resources?
The only thing to pay attention to is that the scheduler, has a certain precision, so the delay may turn out to be slightly larger than aimed for.
For testing purposes, BTW, depending on the situation, I sometimes use a count down latch instead of timed delays. When possible, it makes the tests much faster to execute.