> > Same way as you deal with all resources. ie call close(), > > release() etc. > > So can I assume that every component, or every XXXXManager > has a close() or release() method?
I'd not suggest that...if you want to isolate the client from determining whether the component has/needs the close()/release(), use a utility. > "Every pair of component C and its associated CManager interfaces > must define a method that, when called by the client, indicates > that the client is finished using the component C. The method > may be in the CManager interface - for example, > CManager.release (C c) - or in the C interface - for example, > C.close (). Note that this contract applies to component > *interfaces*. > even if the implementation does not require an end-of-transaction > signal from the client, the method must be specified so > implementations > that do require such a signal can recieve them." > > How about that? make that: A component must define a method with the following signature: public void release(); or a component's manager (if it exists) must define a method with the following signature: public void release( Object ); at the interface level, that, when called by a client, indicates that the client is finished using the component if it has any resources that require releasing. You can even write a ReleaseUtil that uses some minimal reflection to determine whether the method exists and calls it if it does, then always use that in all of your components (have this in C++ project of mine). ReleaseUtil::release( component, manager ) if component has method "public void release()" component.release() return if manager has method "public void release(Object)" manager.release( component ) return I would prefer though (cleaner, no reflection): /** * If an object implements this interface, it is the responsibility * of anyone that uses it to call the release() method when it is done * using it. */ interface RequiresRelease { public void release(); } so you get class ReleaseUtil { public static release( Object obj ) { if( obj instanceof RequiresRelease ) ((RequiresRelease)obj).release(); } } class SomeComponent { SomeManager m; // presumably a pool... compose( ComponentManager cm ) throws ComponentException { m = cm.lookup( SomeManager.ROLE ); } doWork() { try { SomeObject comp = m.getObject(); //bla } catch( Throwable t ) { //logme } finally { ReleaseUtil.release( comp ); } } } point is: release() is not made part of the lifecycle part of the framework or any of those interfaces. This should probably become a part of a generic pooling solution. cjeers, - Leo -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>