Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Where's the best place to put code that shutdowns Ehcache CacheManager ?
Where's the best place to put code that shutdowns Ehcache CacheManager ? [message #508813] Wed, 20 January 2010 12:50 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi all,

Our RAP application uses Ehcache caching library which needs to be
shutdown when application exits. The recommended way to shutdown for web
app is by registering ShutdownListener in web.xml.

I was considering the SessionStoreListener, but since Ehcache scope is
supposed to be application wide, I don't think it's the appropriate
place to shutdown when a session is about to be destroyed.

I've tried the Activator#stop(), when I stop the bundle individually
from OSGI console (stop <bundleid> command) it's got called, but if I
shutdown OSGI itself (exit command) it's not.


Any advice would be greatly appreciated.


Regards,

Setya
Re: Where's the best place to put code that shutdowns Ehcache CacheManager ? [message #508845 is a reply to message #508813] Wed, 20 January 2010 14:30 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
The exit console command simply does System.exit(0). It is not a safe way to shutdown the framework. Try the close command on the console. Programatically this can be done by calling stop() on the system bundle (the bundle with bundle id 0). This should do proper shutdown of the framework.

HTH

Tom.
Re: Where's the best place to put code that shutdowns Ehcache CacheManager ? [message #509001 is a reply to message #508845] Thu, 21 January 2010 05:05 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi,

Thanks for answering.

> The exit console command simply does System.exit(0). It is not a safe
> way to shutdown the framework. Try the close command on the console.
> Programatically this can be done by calling stop() on the system bundle
> (the bundle with bundle id 0). This should do proper shutdown of the
> framework.

I've tried to use close command to shutdown OSGI, but Activator#stop()
didn't get called either.


Regards,

Setya
Re: Where's the best place to put code that shutdowns Ehcache CacheManager ? [message #509156 is a reply to message #509001] Thu, 21 January 2010 14:36 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Sorry for asking an obvious question, did you verify that the Activator#start() method was called? The framework will only call the Activator#stop() method for bundles that are active at the time the framework is shutdown.

Tom.
Previous Topic:How to Start a bundle programatically
Next Topic:Possible bug in PreferenceService#getByteArray
Goto Forum:
  


Current Time: Tue Apr 23 14:56:03 GMT 2024

Powered by FUDForum. Page generated in 0.04031 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top