James, Thanks for the response...
I will add a JIRA enhancement request, assuming I can get registered and get the data entered. To check my understanding, could you validate the following: I think that hivemind has two notions. "Destroying an object" which occurs when the registry shuts down for a "singleton" or "pooled", and occurs when a thread is cleaned up for a "threaded". Hivemind explicitly singles out the "Destroying an object" for a "threaded" service into the Discardable interface. "Activating an object back out of a pool" and "Passivating an object into a pool" occurs when at thread clean when a pooled service is put back into the pool and made available for other threads to take it out of the pool. Hivemind implements this using the PoolManageable interface. I like the name destroy-method. I think you are right, the service model has to take responsibility for ensuring that the proper semantic is maintained. Now for a few questions: Should the notion of activating and passivating an object also have an attribute? Should something introspect for magic public void method() names? Such as destroyService(), activateService(), and passivateService() Is it appropriate for the "Destroying an object" regardless of registry shutdown or thread discard? I ask this because Hivemind explicitly separates the two ideas in the Discardable interface and the RegistryShutdownListener interface. This is how I would specify the feature. add a destroy-method attribute to the construct element recognized by BuilderFactory When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the Discardable.threadDidDiscardService() method. add a activate-method attribute to the construct element recognized by BuilderFactory When the activate-method is specified, the method must be a public void method taking no parameters. This method is called either just before the service is created, or just after the service is removed from the service pool and bound to a new thread. When autowire-service is enabled and activate-method is not specified, BuilderFactory will introspect for a method called activateService() and treat it as a activate-method. If the service also implements the PoolManageable interface, the activate-method is called before the PoolManageable.activateService() method. add a passivate-method attribute to the construct element recognized by BuilderFactory When the passivate-method is specified, the method must be a public void method taking no parameters. This method is called when a service is unbound from a thread, just before being returned to the service pool. When autowire-service is enabled and passivate-method is not specified, BuilderFactory will introspect for a method called passivateService() and treat it as a passivate-method. If the service also implements the PoolManageable interface, the passivate-method is called before the PoolManageable.passivateService() method. I would not have asked for this, but I'm getting pressure from other groups to reuse my beans in Spring instead of Hivemind, yes I know they integrate, but that was expressly not desired. The only thing I can do right now is to create hivemind extensions to my objects that are for the sole purpose of implementing the hivemind interfaces, this seems like unneeded work imposed by a light weight container. Richard -----Original Message----- From: James Carman [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 03, 2005 6:10 PM To: [email protected] Subject: RE: RegistryShutdownListener interface Richard, I asked for this before, I think. What I wanted was to make a Hibernate Session a service and have the registry actually call the close() method for me upon thread cleanup (we should probably name the attribute "destroy-method" rather than "shutdown-method" so folks know that it can be called on thread cleanup as well as registry shutdown). Now, I have to perform a little trick like I did in the code that came with my article to automatically close the session on thread cleanup. I think the service models would have to take responsibility for making sure that the destroy-method is called at the appropriate time (registry shutdown for pooled, singleton, and primitive and upon thread cleanup for threaded), similar to how I did it in my custom service implementation factory. I would recommend creating a JIRA issue for this enhancement request and we can discuss/vote there. What do you think? James -----Original Message----- From: Hensley, Richard [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 03, 2005 6:37 PM To: [email protected] Subject: RegistryShutdownListener interface Would it be possible to make the RegistryShutdownListener interface an optional thing? It should be possible to add a shutdown-method attribute to the construct element of the BuilderFactory, and possible to have the hivemind.BuilderFactory look for a shutdownService() method. It seems that this would allow service implementations to be one step closer to being container agnostic. We might also want to consider using the shutdownService() method, or something similiarly named, for when a threaded service is discarded. I'm reusing some services that have been previously used in Spring. Spring has a an attribute called destroy-method that is analogous to what I'm talking about. The beans I'm reusing happen to use this feature of Spring instead of implementing a Spring specific interface of DisposableBean. Fortunately, Hivemind already has the initialize-method attribute, which these beans also make use of because there is a similar feature in Spring. Richard --------------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
