karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CLEMENT Jean-Philippe <jean-philippe.clem...@fr.thalesgroup.com>
Subject RE: Karaf shutdown
Date Fri, 18 Nov 2016 11:10:10 GMT
Well, that’s not the case when a bundle refuses to stop – I get no event. Ah I forgot to
mention that Equinox is used instead of Felix.

May I open a bug for this?


De : Guillaume Nodet [mailto:gnodet@apache.org]
Envoyé : vendredi 18 novembre 2016 11:52
À : user
Objet : Re: Karaf shutdown

The SynchronousBundleListener is the way to go.
You should receive a STOPPING event for the system bundle before any other bundle is actually

2016-11-18 11:38 GMT+01:00 CLEMENT Jean-Philippe <jean-philippe.clement@fr.thalesgroup.com<mailto:jean-philippe.clement@fr.thalesgroup.com>>:
Is there a way to get a shutdown event?


De : CLEMENT Jean-Philippe [mailto:jean-philippe.clement@fr.thalesgroup.com<mailto:jean-philippe.clement@fr.thalesgroup.com>]
Envoyé : jeudi 17 novembre 2016 17:03
À : user@karaf.apache.org<mailto:user@karaf.apache.org>
Objet : Karaf shutdown

Dear Karaf addicts :)

I would like Karaf to stop. This may fail to happen when (at least) a bundle does not end.
So I added a watchdog which exits Java when a time limit has been exceeded (note: maybe there
is already a way to do so - ?). The way I coded it does not work when the shutdown is made
via the Karaf prompt, so I decided to enhance it.

Googling “Karaf shutdown hook”, I found an old thread talking about SynchronousBundleListener.
The issue I’m facing is that I get no event when performing bundle0.stop(Bundle.STOP_TRANSIENT)
and one of the bundles refuses to stop. The listener is registered via bundle0.getBundleContext().addBundleListener(new
SynchronousBundleListener() { … }).

Is it normal? How to force Karaf to shutdown?

PS: Karaf version is 4.0.7


Guillaume Nodet
Red Hat, Open Source Integration

Email: gnodet@redhat.com<mailto:gnodet@redhat.com>
Web: http://fusesource.com<http://fusesource.com/>
Blog: http://gnodet.blogspot.com/

View raw message