public class GenericPool extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_DEADLOCKMAXWAIT |
static int |
DEFAULT_DEADLOCKRETRYWAIT |
static long |
DEFAULT_EXPIRATION |
static int |
DEFAULT_MAXSIZE |
static int |
DEFAULT_MINSIZE |
static long |
DEFAULT_SLEEPTIME |
protected int |
generation
Generation number.
|
protected Thread |
keeper |
protected PoolKeeper |
poolKeeper |
| Constructor and Description |
|---|
GenericPool(PoolHelper helper)
Creates an GenericPool with the default params.
|
GenericPool(PoolHelper helper,
int initSize) |
GenericPool(PoolHelper helper,
int minSize,
int maxSize,
long lifeTime,
long sleepTime)
Constructor, set the two hashtables and set by default the other values
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkIn(Object o)
remove object from locked pool
|
Object |
checkOut(String user,
String password)
return pooled object
|
boolean |
checkOwner(GenerationObject genObject,
String user,
String password) |
protected void |
cleanUp()
Remove unusable objects from the pool, called by PoolKeeper
Check the unlocked objects for expired members.
|
int |
getCheckLevelObject() |
int |
getCount() |
long |
getDeadLockMaxWait() |
long |
getDeadLockRetryWait() |
int |
getGeneration() |
long |
getLifeTime() |
Hashtable |
getLockedObject() |
int |
getLockedObjectCount()
returns the current number of objects that are locked
|
int |
getMaxSize() |
int |
getMinSize() |
long |
getSleepTime() |
int |
getUnlockedObjectCount()
returns the current number of objects that are unlocked
|
boolean |
isDebug() |
boolean |
isGC() |
void |
minimumObject() |
void |
minimumObject(String user,
String password) |
void |
nextGeneration(Object obj)
Allows to verify if objects from the pool - for the o generation -
are valid or not.
|
void |
removeLockedObject(Object obj)
removes an object for the locked pool, when an error has occurred
|
void |
setCheckLevelObject(int level)
level are accepted between 0 and 4
|
void |
setDeadLockMaxWait(long deadLock) |
void |
setDeadLockRetryWait(long deadLockRetryWait) |
void |
setDebug(boolean debug) |
void |
setGC(boolean gc) |
void |
setGeneration(int generation) |
void |
setLifeTime(long lifeTime) |
void |
setLogger(Logger alog)
Outputs a log message to the log writer.
|
void |
setMaxSize(int max) |
void |
setMinSize(int min) |
void |
setSleepTime(long sleepTime) |
void |
start()
Start method, to initialize independant values of the pool
|
void |
stop()
switch off the pool
|
String |
toString()
returns information from the pool
|
protected Thread keeper
protected PoolKeeper poolKeeper
protected int generation
public static final long DEFAULT_EXPIRATION
public static final long DEFAULT_SLEEPTIME
public static final int DEFAULT_MINSIZE
public static final int DEFAULT_MAXSIZE
public static final int DEFAULT_DEADLOCKMAXWAIT
public static final int DEFAULT_DEADLOCKRETRYWAIT
public GenericPool(PoolHelper helper)
public GenericPool(PoolHelper helper, int initSize)
public GenericPool(PoolHelper helper, int minSize, int maxSize, long lifeTime, long sleepTime)
public void start()
public boolean checkOwner(GenerationObject genObject, String user, String password)
public Object checkOut(String user, String password) throws Exception
Exceptionpublic void minimumObject()
public void checkIn(Object o)
public void setDebug(boolean debug)
public boolean isDebug()
public void setLifeTime(long lifeTime)
public void setSleepTime(long sleepTime)
public void setGeneration(int generation)
public void setGC(boolean gc)
public void setCheckLevelObject(int level)
public void setDeadLockMaxWait(long deadLock)
public void setDeadLockRetryWait(long deadLockRetryWait)
public int getMinSize()
public int getMaxSize()
public long getLifeTime()
public boolean isGC()
public int getCount()
public long getSleepTime()
public int getGeneration()
public int getCheckLevelObject()
public void stop()
public int getLockedObjectCount()
public int getUnlockedObjectCount()
public long getDeadLockMaxWait()
public long getDeadLockRetryWait()
public String toString()
protected void cleanUp()
public void nextGeneration(Object obj)
public void removeLockedObject(Object obj)
public void setLogger(Logger alog)
public Hashtable getLockedObject()
Copyright © 2014–2015. All rights reserved.