MentaContainer

Rev

Rev 64 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
64 soliveira 1
package org.mentacontainer;
2
 
70 soliveira 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
 */
64 soliveira 22
public interface Clearable<E> {
23
 
24
        public void onCleared(E clearedObject);
25
}