On Aug 1, 7:23 pm, "E. Biggs" <tacoban...@gmail.com> wrote:
> Ah, reimplemented with ActorPing and love it, thanks...  Just out of
> curiosity though, what are the reasons for strongly recommending not
> having sleep in actors? I mean besides that you can obviously get
> yourself into trouble - even create a deadlock..  but in my case my
> sleeping actor never received any messages itself so it seems safe?
> (besides the ctrl-c problem) ..  but with this ActorPing the issue is
> moot, but just curious..

When an actor recives a message it obviously executes the computation
in the context of a thread. If we sleep there that thread is not
returned to the thread pool hence consuming threads for nothing. The
faster/shorter the actor computation is the faster the thread is
returned to the thread pool hence giving it the opportunity to be re-
used => critical for scalability.

>
> On Aug 1, 5:47 am, "marius d." <marius.dan...@gmail.com> wrote:
>
> > I'd strongly recommend not to use sleep in the actors. Please see
> > Lift's ActorPing that does exactly what you need.
>
> > You have:
>
> > def schedule(to: Actor, msg: Any, delay: TimeSpan) // send a message
> > to the given actor after a delay
>
> > or
>
> > def scheduleAtFixedRate(to: Actor, msg: Any, initialDelay: TimeSpan,
> > delay: TimeSpan) // same as above except it repeats the process
>
> > Br's,
> > Marius
>
> > On Aug 1, 3:40 pm, "E. Biggs" <tacoban...@gmail.com> wrote:
>
> > > attn beautiful, generous lift gurus,
>
> > > I've spawned off a scheduling actor that spend most of its time
> > > asleep; it just wakes up to tell another actor when to do things i.e:
> > > actor{ loop{ sleep( an hour ); mainActor ! "do something" }}. Works
> > > like a champ except for one thing: jetty can't get clobbered with the
> > > good ol trusty ctrl-c anymore :( It reports a message about not
> > > interrupting my actor's sleep: java.lang.InterruptedException: sleep
> > > interrupted...  GAH! enough beauty rest already! Time to die!
>
> > > Now I got a couple things to try, and things to google - but I could
> > > surely spare myself some time by pinging you guys since one or all of
> > > you are likely to instantly know what to do ...
>
> > > ****
> > > Oh as a side topic for any who wish to share. Anybody have advice/
> > > wisdom on a development web container or time saving tips?. Obviously
> > > the jetty/javarebel/scala:cc is ten shades of awesome..  but this is
> > > more with regards to changes that fall out of that scope...  I
> > > recently read an article written by a guy that was hot-deploying is
> > > lift apps in glassfish 3 (http://weblogs.java.net/blog/vivekp/archive/
> > > 2008/05/scala_lift_web.html). I was thinking it might be worth looking
> > > into hot deploy - but then realized jetty starts and stops so fast
> > > that it might as well be a hot deploy already. In fact, the bulk of my
> > > jetty:run time is spent letting maven do its thing. So is anybody else
> > > as impatient and me and have any tips to share? I already do the mvn -
> > > o to shave off a few seconds but is there any easy trick to shave off
> > > more? Perhaps bypassing maven entirely? Or is there any other
> > > container / deployment mechanism you guys like?
>
> > > Thanks guys,
>
> > > e
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to