Hi,

I want to put my "custom" db connections into the cache service.  Such that when they 
are no longer in use - they will get closed - ie if the site is not busy - or a new 
WAR has been loaded into tomcat and so the old connection is generally unavailable...

In order to do this, I need to be able to notify a cached object that it is still in 
use and to handle closing the connection when it is removed from the cache.

Thus I propose the following changes;

Add a method "resetExpiry()" on the CachedObject class, which resets the created time 
to now.

Add a listener facility to the CachedObject - allowing you to add/remove listeners 
conforming to the interface CacheListener, which has 1 method 
"cachedObjectFinalizer(CachedObject obj)". 

In the CacheService during clearCache - it will call a new method 
"cachedObjectFinalizer" on CachedObject, which will in turn notify all listeners that 
this object is about to leave the cache.  

I can then add a listener for my db cache entry and when it is called, then call it 
close method to tidy up any resources used.

So - what do you think?  Ok in priniciple?  Ok specifically?

I will post patches for this later today, assuming no objections.

Regards,
Chris
---
"surely it is madness to accept life as it is and not as it could be"
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to