The g8 template definitely needs fixing then. :-)

Sent from my iPhone

On 20/03/2013, at 1:07 AM, Roland Kuhn <notifications@github.com> wrote:

> In src/main/scala/org/typesafe/Akkaspring.scala:
> 
> > @@ -73,13 +103,9 @@ object Akkaspring extends App {
> >  
> >    implicit val timeout = Timeout(5 seconds)
> >  
> > -  (counter ? Get) onSuccess {
> > -    case count => println("Count is " + count)
> > -  }
> > -
> > -  // You shouldn't normally require sleeping, but our example will execute asynchronously of course and we need to
> > -  // ensure that there is enough time elapsed so that our actor can respond.
> > -  Thread.sleep(500L)
> > +  // wait for the result and print it, then shut down the services
> > +  (counter ? Get) andThen {
> > +    case count ⇒ println("Count is " + count)
> > +  } onComplete { _ => services.shutdown() }
> >  
> No, I’m not a big fan of having to write a comment “you would normally not do this” inside a piece of code which is meant as a best practices template. The sleep is simply neither reliable nor nice.
> 
> Shutting down the ActorSystem when you have determined that you’re done is exactly the right thing to do, and my code does just that. I haven’t looked closely at the g8 template in a while, maybe that needs to be fixed.
> 
> —
> Reply to this email directly or view it on GitHub.