I'm thinking something like (let's figure out better names):

public interface Manageable
{
  public void enlistService();

  public void poolService();

  public void shutdownService();
}


enlistService() -- invoked at creation, and as a pooled service instance is removed 
from the pool
and enlisted/attached to a thread.

poolService() -- invoked during thread cleanup, before returning a service to a pool 
(if the service
model supports pooling).

shutdownService() -- invoked in response to Registry.shutdown(); affects both active 
(out of the
pool) and inactive (in the pool) services.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
http://jakarta.apache.org/commons/sandbox/hivemind/
http://javatapestry.blogspot.com

> -----Original Message-----
> From: Christian Essl [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, September 28, 2003 5:46 PM
> To: [EMAIL PROTECTED]
> Subject: [HiveMind] Destroy service
> 
> 
> I've written a Service which registers Destroyable Services 
> (a special 
> interface which must be implemented by the service-interace) 
> and keeps 
> dependencies between Services. When the application using a 
> Registry shut- 
> downs (and no other thread is using the Registry anymore) it 
> calls on the 
> Service destroy() and the Service will call the destroy() 
> methods on all 
> the registered Services in the right order.
> 
> This helps me in my project to easier maintain the right 
> shut-down for 
> Services which need information about ie when they should release 
> resources.
> 
> Currently the dependencies and registration of the Services 
> happens through 
> contributions. However when Howard makes it possible to get 
> the Shema and I 
> can implement a ConfigurationBeanFactory I think of 
> implementing a special 
> rule and transformer which automaticly registers a 
> dependend/destryable 
> object when the user creates one or gives it to aother 
> service. This would 
> free the user of a service-implementation of filling in the 
> dependency- 
> contribution, which is of course error-prone.
> 
> Is there any intrest in such a Service to be included in HiveMind?
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to