|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Provides interface for an object pool.
This class provides interface for a generic object pool. The cached objects may
optionally implement the Cacheable
interface, which provides a basic event
handler, informing the objects about their state related to the caching process.
Method Summary | |
void |
clear()
Removes all objects from the pool. |
java.lang.Object |
get()
Gets an object from the pool. |
boolean |
put(java.lang.Object obj)
Puts the object to the pool. |
Method Detail |
public boolean put(java.lang.Object obj)
If an object implementing the Cacheable
interface is being added to the
pool, the Cacheable.handleCacheEvent(Cacheable.CacheEvent)
method must
be invoked on it with the Cacheable.CacheEvent.ADDED
value. If the object
cannot be put to the pool for any reason, the method must return false,
otherwise it returns true.
obj
- the cached object
public java.lang.Object get()
The object is removed from the pool and returned to the caller.
If an object implementing the Cacheable
interface is being removed from the
pool, the Cacheable.handleCacheEvent(Cacheable.CacheEvent)
method must be
invoked on it with the Cacheable.CacheEvent.REMOVED
value.
public void clear()
If an object implementing the Cacheable
interface is being removed from the
pool, the Cacheable.handleCacheEvent(Cacheable.CacheEvent)
method must be invoked
on it with the Cacheable.CacheEvent.INVALIDATED
value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |