[akka-user] Akka shutdown

113 views
Skip to first unread message

Shimi

unread,
Apr 27, 2010, 7:54:56 AM4/27/10
to Akka User List
Is there a way to shutdown Akka gracefully?

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Viktor Klang

unread,
Apr 27, 2010, 7:59:19 AM4/27/10
to akka...@googlegroups.com
Hi Shimi,

If you're running akka in microkernel mode: se.scalablesolutions.akka.kernel.Kernel.shutdown

If you're running it in an app-server you just need to undeploy the app.


Does that help?


Cheers,
--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Akka - the Actor Kernel: Akkasource.org
Twttr: twitter.com/viktorklang

Shimi

unread,
Apr 27, 2010, 8:39:47 AM4/27/10
to Akka User List
microkernel mode.

> se.scalablesolutions.akka.kernel.Kernel.shutdown
Are you sure? there is no shutdown in
se.scalablesolutions.akka.kernel.Kernel

Exception in thread "main" java.lang.NoClassDefFoundError: se/
scalablesolutions/akka/kernel/Kernel/shutdown
Caused by: java.lang.ClassNotFoundException:
se.scalablesolutions.akka.kernel.Kernel.shutdown
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
Could not find the main class:
se.scalablesolutions.akka.kernel.Kernel.shutdown. Program will exit.

Am I missing something here?

On Apr 27, 2:59 pm, Viktor Klang <viktor.kl...@gmail.com> wrote:
> Hi Shimi,
>
> If you're running akka in microkernel mode:
> se.scalablesolutions.akka.kernel.Kernel.shutdown
>
> If you're running it in an app-server you just need to undeploy the app.
>
> Does that help?
>
> Cheers,
>
> On Tue, Apr 27, 2010 at 1:54 PM, Shimi <shim...@gmail.com> wrote:
> > Is there a way to shutdown Akka gracefully?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Akka User List" group.
> > To post to this group, send email to akka...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > akka-user+...@googlegroups.com<akka-user%2Bunsubscribe@googlegroups .com>
> > .

Viktor Klang

unread,
Apr 27, 2010, 8:46:12 AM4/27/10
to akka...@googlegroups.com
Kernel extends AkkaLoader, AkkaLoader has a shutdown method.
Which version of Akka are you running?

object Kernel extends AkkaLoader {

class AkkaLoader extends Logging {

Cheers,

Shimi

unread,
Apr 27, 2010, 8:53:56 AM4/27/10
to Akka User List
version 0.8.1 and yes AkkaLoader has a shutdown method but how can I
call it from command line without Main

On Apr 27, 3:46 pm, Viktor Klang <viktor.kl...@gmail.com> wrote:
> Kernel extends AkkaLoader, AkkaLoader has a shutdown method.
> Which version of Akka are you running?
>
> object Kernel extends AkkaLoader
> {<http://github.com/jboner/akka/blob/master/akka-kernel/src/main/scala/...>
>
> class AkkaLoader extends Logging
> {<http://github.com/jboner/akka/blob/master/akka-servlet/src/main/scala...>

Viktor Klang

unread,
Apr 27, 2010, 8:57:13 AM4/27/10
to akka...@googlegroups.com
On Tue, Apr 27, 2010 at 2:53 PM, Shimi <shi...@gmail.com> wrote:
version 0.8.1 and yes AkkaLoader has a shutdown method but how can I
call it from command line without Main

If you look at Kernel you can see that Main is just a wrapper around Kernel.boot
if you can't call it from your console, I'd suggest you don't have akka-kernel on your classpath.
 

Shimi

unread,
Apr 27, 2010, 9:12:00 AM4/27/10
to Akka User List
I can see that Main is just a wrapper around Kernel.boot which calls
AkkaLoader.boot
It might be a silly question but I have no idea how can I call
shutdown from command line.


On Apr 27, 3:57 pm, Viktor Klang <viktor.kl...@gmail.com> wrote:
> On Tue, Apr 27, 2010 at 2:53 PM, Shimi <shim...@gmail.com> wrote:
> > version 0.8.1 and yes AkkaLoader has a shutdown method but how can I
> > call it from command line without Main
>
> If you look at Kernel<http://github.com/jboner/akka/blob/master/akka-kernel/src/main/scala/...>you

Viktor Klang

unread,
Apr 27, 2010, 9:54:45 AM4/27/10
to akka...@googlegroups.com
On Tue, Apr 27, 2010 at 3:12 PM, Shimi <shi...@gmail.com> wrote:
I can see that Main is just a wrapper around Kernel.boot which calls
AkkaLoader.boot
It might be a silly question but I have no idea how can I call
shutdown from command line.

Ah, you're talking about from a terminal, I wrongly assumed you meant from an sbt console / a REPL

Akka is built around the principle "Let it crash", so I'd say kill it!
 

Shimi

unread,
Apr 27, 2010, 10:07:38 AM4/27/10
to Akka User List
right. So far I have been killing it.
still, it would have been nice to shut it down properly using init.d
script


On Apr 27, 4:54 pm, Viktor Klang <viktor.kl...@gmail.com> wrote:
> On Tue, Apr 27, 2010 at 3:12 PM, Shimi <shim...@gmail.com> wrote:
> > I can see that Main is just a wrapper around Kernel.boot which calls
> > AkkaLoader.boot
> > It might be a silly question but I have no idea how can I call
> > shutdown from command line.
>
> Ah, you're talking about from a terminal, I wrongly assumed you meant from
> an sbt console / a REPL
>
> Akka is built around the principle "Let it crash", so I'd say *kill* it!

Viktor Klang

unread,
Apr 27, 2010, 10:22:27 AM4/27/10
to akka...@googlegroups.com
On Tue, Apr 27, 2010 at 4:07 PM, Shimi <shi...@gmail.com> wrote:
right. So far I have been killing it.
still, it would have been nice to shut it down properly using init.d
script

Pretend you're shutting it down gracefully ;-)
 

Shawn

unread,
Oct 25, 2013, 3:20:12 PM10/25/13
to akka...@googlegroups.com
I've noticed that if I kill my akka microkernel it spits out some nice messages about shutting down the actor system. So I'm thinking that's at least a little bit graceful?

More importantly, if I kill an akka microkernel process does it give actors a chance to finish processing their current message? How about messages pending in their inboxes?

Akka Team

unread,
Oct 27, 2013, 1:07:59 PM10/27/13
to Akka User List
Hi Shawn,

akka.kernel.Main registers an JVM shutdown hook, which is executed on a best effort basis (e.g. it is not executed when sending SIGKILL or upon VM errors). You control what this does by overriding the Bootable.shutdown() method. If you do ActorSystem.shutdown() within that then that will context.stop() all actors, meaning that after the current message is processed they will terminate, messages left in the mailbox will go to deadLetters (best effort, again).

Regards,

Roland




--
>>>>>>>>>> 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 akka-user+...@googlegroups.com.

To post to this group, send email to akka...@googlegroups.com.



--
Akka Team
Typesafe - The software stack for applications that scale
Blog: letitcrash.com
Twitter: @akkateam
Reply all
Reply to author
Forward
0 new messages