|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.xcap.client.WorkerThreadPool
public class WorkerThreadPool
A general purpose object pool.
Field Summary | |
---|---|
static java.lang.String |
CLASSNAME
Classname |
protected java.lang.Object |
counterLock
An object used for synchronization * |
protected java.lang.Object |
lock
An object used for synchronization * |
static java.util.logging.Logger |
LOGGER
Logger for this class |
protected int |
maxSize
Maximum size of the pool * |
protected int |
minSize
Minimum size of the pool * |
protected java.util.Stack<java.lang.Object> |
pool
A stack for pooling the objects * |
protected int |
threadCounter
Number of threads currently created |
protected WorkerThreadFactory |
workerFactory
The ObjectFactory used to create and destroy objects * |
Constructor Summary | |
---|---|
protected |
WorkerThreadPool()
Empty constructor used for subclassing. |
|
WorkerThreadPool(WorkerThreadFactory workerFactory)
Constructs a default ObjectPool. |
|
WorkerThreadPool(WorkerThreadFactory workerFactory,
int minSize,
int maxSize)
Constructs an WorkerThreadPool with the specified number of minimum and maximum objects. |
Method Summary | |
---|---|
void |
checkin(java.lang.Object o)
Checkin an object back into the pool. |
java.lang.Object |
checkout()
Checkout an object from the pool. |
void |
destroyAll()
Clean up our resources |
int |
getMaxSize()
|
int |
getMinSize()
|
int |
getSize()
|
int |
getThreadCount()
Number of threads created |
void |
incThreadCount()
|
protected void |
init(WorkerThreadFactory workerFactory,
int minSize,
int maxSize)
Initializes an ObjectPool with the specified number of minimum and maximum objects. |
void |
setMaxSize(int maxSize)
|
void |
setMinSize(int minSize)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASSNAME
public static final java.util.logging.Logger LOGGER
protected java.lang.Object lock
protected java.lang.Object counterLock
protected int minSize
protected int maxSize
protected int threadCounter
protected java.util.Stack<java.lang.Object> pool
protected WorkerThreadFactory workerFactory
Constructor Detail |
---|
protected WorkerThreadPool()
public WorkerThreadPool(WorkerThreadFactory workerFactory)
objectFactory
- The ObjectFactory used to create or destroy objects.public WorkerThreadPool(WorkerThreadFactory workerFactory, int minSize, int maxSize)
workerFactory
- The WorkerThreadFactory used to create or destroy objects.minSize
- The minimum number of objects that are kept in the pool.maxSize
- The maximum number of objects that are kept in the pool.Method Detail |
---|
protected void init(WorkerThreadFactory workerFactory, int minSize, int maxSize)
objectFactory
- The ObjectFactory used to create or destroy objects.minSize
- The minimum number of objects that are kept in the pool.maxSize
- The maximum number of objects that are kept in the pool.public java.lang.Object checkout()
public void checkin(java.lang.Object o)
o
- An object to check back into the pool.public int getMinSize()
public int getMaxSize()
public void setMinSize(int minSize)
public void setMaxSize(int maxSize)
public int getSize()
public void incThreadCount()
public int getThreadCount()
public void destroyAll()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |