|
IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.btt.base.BTTProcessorNotifier
com.ibm.btt.base.Service
com.ibm.btt.services.GenericPool
@ATTR(value={"className#String#IMPLIED","serviceName#String#IMPLIED","maxPoolSize#String#IMPLIED","initialSize#String#IMPLIED","timeBetweenRetries#String#IMPLIED","cleanupTime#String#IMPLIED"}) public class GenericPool
The GenericPool is a pool that manages objects that implement the Poolable interface. The pool has an initial size externalized in the service definition. The pool size grows if more instances of Poolable objects are required and the current size is lower than the maximum size. The maximum size is also externalized. The pool size shrinks if the maximum number of concurrent request for communications services during a period of time is lower than the current number of elements in the pool.
Field Summary | |
---|---|
java.lang.String |
className
|
(package private) int |
cleanupTime
Time between resizing processes |
static java.lang.String |
COMPID
|
(package private) int |
indexOfLastSession
Index of the last element that was assigned |
(package private) int |
initialSize
Initial pool size |
(package private) int |
maxConcurrents
Maximum number of concurrent request from the last resizing process |
(package private) int |
maxPoolSize
Maximum pool size |
java.util.Vector |
pool
The pool |
(package private) java.lang.Object |
poolSem
Object used for synchronization purposes |
(package private) int |
requestsCount
Counter of current concurrent requests |
(package private) Semaphore |
sem
Internal semaphore used to notify that a service has been released |
java.lang.String |
serviceName
The service name |
(package private) int |
size
Current pool size |
(package private) int |
spare
Additional percentage of the pool size to be added during the resizing process |
(package private) long |
timeBetweenRetries
Time to wait for a retry when no free service is available |
Fields inherited from class com.ibm.btt.base.Service |
---|
externalizer, name |
Fields inherited from class com.ibm.btt.base.BTTProcessorNotifier |
---|
handlersList |
Constructor Summary | |
---|---|
GenericPool()
Default GenericPool constructor |
|
GenericPool(java.lang.String aName)
This constructor creates a GenericPool object. |
Method Summary | |
---|---|
Poolable |
createPoolable()
Returns a new instance of the Poolable element that is managed in the pool. |
protected void |
freeAll()
Marks every pool element as not in use. |
java.lang.String |
getClassName()
Returns the class name of the Poolable object to place in the pool. |
Poolable |
getPoolable()
Returns the first element in the pool that is not in use. |
Poolable |
getPoolable(boolean newChance)
Returns the first free element available in the pool. |
java.lang.String |
getServiceName()
Returns the service name. |
int |
getSize()
Returns the current pool's size. |
void |
initialize()
Initializes some values, fills the pool, and creates a Thread for the resizing process if necessary. |
java.lang.Object |
initializeFrom(Tag aTag)
Initializes the Service reading its attributes values from aTag. |
void |
initInstance()
Initializes the thread responsible for resizing the pool. |
void |
insertPoolable(Poolable poolable)
Inserts a new Poolable object in the pool. |
boolean |
isThreadIsAlive()
Returns the status of the thread responsible for resizing the pool. |
void |
releasePoolable(Poolable poolable)
Releases a Poolable object. |
protected void |
removeAll()
Removes all the Poolable objects from the pool. |
void |
removePoolable(Poolable poolable)
Removes a Poolable object from the pool. |
void |
run()
Runs the pool thread. |
void |
setClassName(java.lang.String name)
Sets the className attribute to the string provided as an argument. |
void |
setServiceName(java.lang.String name)
Sets the serviceName attribute to the string provided as an argument. |
void |
setSize(int i)
Sets the size attribute to the int provided as an argument. |
void |
terminate()
Frees and closes all the objects from the pool. |
java.lang.String |
toString()
Converts this GenericPoolService to string. |
Methods inherited from class com.ibm.btt.base.Service |
---|
externalizer, getExternalizer, getTagName, readExternal, readExternal, readObject, removeExternal, setExternalizer, toStrings, toTags, writeExternal, writeExternal |
Methods inherited from class com.ibm.btt.base.BTTProcessorNotifier |
---|
addHandler, getHandlersList, getName, removeHandler, setName, signalEvent, signalEvent, signalEvent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.ibm.btt.base.Externalizable |
---|
getName, setName |
Field Detail |
---|
public java.lang.String className
public java.lang.String serviceName
public java.util.Vector pool
public static final java.lang.String COMPID
int indexOfLastSession
int size
int initialSize
java.lang.Object poolSem
int maxPoolSize
long timeBetweenRetries
int cleanupTime
int requestsCount
int maxConcurrents
int spare
Semaphore sem
Constructor Detail |
---|
public GenericPool()
public GenericPool(java.lang.String aName) throws java.io.IOException
aName
- The generic pool service name
java.io.IOException
Method Detail |
---|
public Poolable createPoolable() throws DSEInvalidArgumentException
com.ibm.dse.base.DSEInvalidArgumentException
DSEInvalidArgumentException
protected void freeAll()
public java.lang.String getClassName()
public Poolable getPoolable()
public Poolable getPoolable(boolean newChance)
newChance
- boolean Set to false if the current request is a retry
public java.lang.String getServiceName()
public int getSize()
public void initialize() throws DSEException
com.ibm.dse.base.DSEException
DSEException
public java.lang.Object initializeFrom(Tag aTag) throws java.io.IOException, DSEException
initializeFrom
in class Service
aTag
- com.ibm.dse.base.Tag
java.io.IOException
DSEException
public void initInstance() throws DSEException
com.ibm.dse.base.DSEException
DSEException
public void insertPoolable(Poolable poolable)
Poolable
- The object to be added to the poolpublic boolean isThreadIsAlive()
public void releasePoolable(Poolable poolable)
Poolable
- - The object to be releasedprotected void removeAll()
public void removePoolable(Poolable poolable)
Poolable
- The object to be removedpublic void run()
run
in interface java.lang.Runnable
public void setClassName(java.lang.String name)
name
- The new classNamepublic void setServiceName(java.lang.String name)
name
- The new service namepublic void setSize(int i)
i
- The size of the poolpublic void terminate()
terminate
in interface ProcessorNotifier
terminate
in class Service
public java.lang.String toString()
toString
in class Service
|
IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |