MentaContainer

Compare Revisions

Ignore whitespace Rev 69 → Rev 70

/trunk/src/main/java/org/mentacontainer/Clearable.java
1,5 → 1,24
package org.mentacontainer;
 
/**
* Some components can also implement this interface to perform some cleanup
* when the instance is cleared. For example, a connection pool will want
* to know when the connection instance is cleared so it can return it to
* the pool.
*
* It makes more sense to use this interface for components that will be placed
* in the THREAD scope, but you can also use it with components in the SINGLETON
* scope.
*
* This is particular useful for the THREAD scope for dealing with thread pools, so
* when the thread is returned to the thread pool you will want to clear the THREAD
* scope. That's pretty much how web containers work: one thread per request coming from
* a thread pool.
*
* @author sergio.oliveira.jr@gmail.com
*
* @param <E>
*/
public interface Clearable<E> {
public void onCleared(E clearedObject);