|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.atomikos.util.BaseObjectPool
public abstract class BaseObjectPool
Copyright © 2001, Atomikos. All rights reserved. A general implementation of an object pool.
| Field Summary | |
|---|---|
protected long |
maxSize_
|
protected Hashtable |
pool_
|
protected long |
size_
|
| Constructor Summary | |
|---|---|
BaseObjectPool(long maxSize)
Constructor. |
|
| Method Summary | |
|---|---|
Identifiable |
add(Identifiable object)
Add an identifiable instance to the pool. |
Enumeration |
elements()
Retrieve an enummeration of all elements in the pool. |
long |
getMaxSize()
Get the maximum size of the pool. |
long |
getSize()
Get the current size of the pool. |
protected abstract Object |
getVictim()
Get a victim for removal if pool is full. |
protected Enumeration |
internalElements()
Returns an enummeration of PooledObject instances for use in subclasses. |
boolean |
isEmpty()
Test if pool is empty. |
boolean |
isFull()
Test if pool is full. |
Identifiable |
remove()
Remove an arbitrary element from the pool. |
Identifiable |
remove(Object id)
Remove an object from the pool. |
Identifiable |
retrieve()
Get an arbitrary element from the pool. |
Identifiable |
retrieve(Object id)
Retrieve an object from the pool. |
protected abstract PooledObject |
wrap(Identifiable object)
Wrap an instance into a pool handle object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Hashtable pool_
protected long size_
protected long maxSize_
| Constructor Detail |
|---|
public BaseObjectPool(long maxSize)
maxSize - The max size of the pool.
If negative or zero, a default size will be taken.| Method Detail |
|---|
public long getSize()
ObjectPool
getSize in interface ObjectPoolObjectPoolpublic long getMaxSize()
ObjectPool
getMaxSize in interface ObjectPoolObjectPoolpublic boolean isFull()
ObjectPool
isFull in interface ObjectPoolObjectPoolpublic boolean isEmpty()
ObjectPool
isEmpty in interface ObjectPoolObjectPoolpublic Identifiable add(Identifiable object)
ObjectPool
add in interface ObjectPoolObjectPool
public Identifiable retrieve(Object id)
throws ObjectNotFoundException
ObjectPool
retrieve in interface ObjectPoolid - The id of the object wanted.
ObjectNotFoundException - If not found.ObjectPool
public Identifiable retrieve()
throws ObjectNotFoundException
ObjectPool
retrieve in interface ObjectPoolObjectNotFoundException - If empty.ObjectPool
public Identifiable remove()
throws ObjectNotFoundException
ObjectPool
remove in interface ObjectPoolObjectNotFoundException - If empty.ObjectPool
public Identifiable remove(Object id)
throws ObjectNotFoundException
ObjectPool
remove in interface ObjectPoolid - The identifier for the object.
ObjectNotFoundException - If the id was not in the pool.ObjectPool
public Enumeration elements()
throws ObjectNotFoundException
ObjectPool
elements in interface ObjectPoolObjectNotFoundException - If empty.ObjectPoolprotected Enumeration internalElements()
protected abstract Object getVictim()
protected abstract PooledObject wrap(Identifiable object)
object - The instance.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||