karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raman Gupta <rocketra...@gmail.com>
Subject Re: RFC on proposal to allow hooks into Karaf shutdown
Date Sun, 02 Dec 2012 16:47:50 GMT
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

Mime
View raw message