karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject Re: RFC on proposal to allow hooks into Karaf shutdown
Date Sun, 02 Dec 2012 19:44:16 GMT
As I explained, I don't think that's possible.
The Main class is only responsible for shutting the framework when using
the bin/stop script and it does not have anything to do when shutting down
the framework from the inside using osgi:shutdown (or anything calling stop
on the system bundle).
Another way to ensure that the listener will be called first would be to
give to its bundle a very low start level so that it's listener will be
registered first.


On Sun, Dec 2, 2012 at 5:47 PM, Raman Gupta <rocketraman@gmail.com> wrote:

> On 11/30/2012 01:56 AM, Jean-Baptiste Onofré wrote:
> > On 11/30/2012 05:15 AM, Raman Gupta wrote:
> >> I sent this to the users mailing list, but it probably belongs more on
> >> dev. I'd like to hook into the Karaf shutdown process at a higher
> >> level than the OSGi bundle shutdown. The bundle shutdown starts
> >> prematurely shutting down services and such that are necessary for
> >> work in progress to complete.
> >
> > it's more or less already available. I'm not against enhancement
> > around that, but, maybe it's redundant with the following.
> >
> > You can more or less already do something like this using a
> > SynchronousBundleListener (you will received the STOPPING event on
> > bundleId 0, so the framework), or a FrameworkListener (to hook on
> > the framework).
>
> I think there might still be some room for improvement here...
>
> The problem I'm having is that Spring-DM also hooks a
> SynchronousBundleListener into the OSGi framework. Because Spring-DM's
> listener is registered first, and executes first, it goes ahead and
> shuts down all my bundles *before* my listener gets a chance to do
> anything useful.
>
> (As an aside, for a STOPPING/STOPPED event, IMO it would make sense to
> execute listeners in reverse order i.e. the higher level listeners
> registered later should be executed first, rather than last. However,
> I guess this wasn't specified in the OSGi spec so nothing can be done
> there. There also appears to be no way specified to control the order
> explicitly.)
>
> So... I still think it would be useful if Karaf provided an event or
> hook for just before a shutdown begins. Thoughts?
>
> Regards,
> Raman
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message