MentaContainer

Rev

Rev 64 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64 Rev 70
1
package org.mentacontainer;
1
package org.mentacontainer;
2
2
-
 
3
/**
-
 
4
 * Some components can also implement this interface to perform some cleanup
-
 
5
 * when the instance is cleared. For example, a connection pool will want
-
 
6
 * to know when the connection instance is cleared so it can return it to
-
 
7
 * the pool.
-
 
8
 *
-
 
9
 * It makes more sense to use this interface for components that will be placed
-
 
10
 * in the THREAD scope, but you can also use it with components in the SINGLETON
-
 
11
 * scope.
-
 
12
 *
-
 
13
 * This is particular useful for the THREAD scope for dealing with thread pools, so
-
 
14
 * when the thread is returned to the thread pool you will want to clear the THREAD
-
 
15
 * scope. That's pretty much how web containers work: one thread per request coming from
-
 
16
 * a thread pool.
-
 
17
 *
-
 
18
 * @author sergio.oliveira.jr@gmail.com
-
 
19
 *
-
 
20
 * @param <E>
-
 
21
 */
3
public interface Clearable<E> {
22
public interface Clearable<E> {
4
       
23
       
5
        public void onCleared(E clearedObject);
24
        public void onCleared(E clearedObject);
6
}
25
}