I have an application in which, when it's given the stop command, I'd
like to finish some work in progress before shutting down bundle 0.
This is because the bundle shutdown starts prematurely shutting down
services and such that are necessary for the work to complete.

For now, I've implemented this with a custom Karaf command that
executes my application shutdown, and then delegates to the Karaf
StopCommand to shutdown Karaf itself.

However, this is not an ideal solution as it requires my custom
command to be explicitly executed. For example, it will not run when a
user does a normal kill or Ctrl-D.

Ideally, Karaf would have a "ShutdownHook" interface/service I could
implement in my bundles -- for each one of these registered, Karaf
would execute them before stopping the framework bundles. If someone
could give me some starting pointers, I could look into implementing
this...

Regards,
Raman

Reply via email to