|
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.comms.CommunicationsPool
@ATTR(value={"size#String#IMPLIED","spare#String#IMPLIED","maxPoolSize#String#IMPLIED","timeBetweenRetries#String#IMPLIED","cleanupTime#String#IMPLIED","identicalElements#String#REQUIRED"}) public class CommunicationsPool
The CommunicationsPool is a pool that manages communications services that implement the CommonCommunicationsService interface. The pool has an initial size externalized in the service definition. The pool size grows if more instances of communications services 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 services in the pool.
Field Summary | |
---|---|
(package private) int |
cleanupTime
Time between resizing processes |
static java.lang.String |
COMPID
|
(package private) boolean |
identicalElements
Indicates if the elements on the pool are identical |
(package private) int |
indexOfLastSession
Index of the last service 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 |
(package private) long |
nameIndex
nameIndex |
(package private) java.util.Vector |
pool
The communications pool |
(package private) java.lang.Object |
poolSem
Object used for synchronization purposes |
(package private) int |
requestsCount
Counter of concurrent request |
(package private) Semaphore |
sem
Internal semaphore used to notify that a service has been released |
(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 | |
---|---|
CommunicationsPool()
This constructor creates a CommunicationsPool object. |
|
CommunicationsPool(java.lang.String aName)
This constructor creates a CommunicationsPool object. |
Method Summary | |
---|---|
boolean |
areAllServicesOffline()
Checks if at least one service in the pool is in session. |
void |
closeAll()
Closes all pool instances. |
protected void |
freeAll()
Marks every pool element as not used. |
int |
getCleanupTime()
Returns the cleanupTime attribute. |
boolean |
getIdenticalElements()
Returns the identicalElements attribute. |
int |
getMaxPoolSize()
Returns the maxPoolSize attribute. |
CommonCommunicationsService |
getPoolService()
Returns the first free service in the pool or null if no free services are available. |
int |
getRequestsCount()
returns a count of the number of pool elements that are in use. |
protected CommonCommunicationsService |
getSessionWithName(java.lang.String name)
Returns a communications service from the pool. |
int |
getSize()
Returns the size attribute. |
int |
getSpare()
Returns the spare attribute. |
Tag |
getTag()
Returns the tag attribute. |
long |
getTimeBetweenRetries()
Returns the timeBetweenRetries attribute. |
java.lang.Object |
initializeFrom(Tag aTag)
Initializes a CommunicationsPool with the Tag attributes. |
void |
initInstance()
Initializes the thread responsible for resizing the pool. |
void |
insertService(CommonCommunicationsService aService)
Inserts a new communications service in the pool. |
boolean |
isThreadIsAlive()
Returns the status of the thread responsible for resizing the pool. |
void |
openAll()
Opens all the communications services in the pool by sending ccOpen() to all the services in the pool. |
void |
releaseAndRemovePoolService(CommonCommunicationsService aService)
Release a communication service and then remove it from communication pool. |
void |
releasePoolService(CommonCommunicationsService aService)
Releases a communications service. |
protected void |
removeAll()
Removes all the communications services from the pool. |
void |
removeService(CommonCommunicationsService aService)
Removes a communications service from the pool. |
void |
run()
Runs the pool thread. |
void |
setCleanupTime(int aTime)
Sets cleanupTime attribute value. |
void |
setIdenticalElements(boolean aBoolean)
Sets identicalElements attribute value. |
void |
setMaxPoolSize(int aMaxPoolSize)
Sets maxPoolSize attribute value. |
void |
setSize(int aSize)
Sets size attribute value. |
void |
setSpare(int aSpare)
Sets spare attribute value. |
void |
setTag(Tag aTag)
Sets tag attribute value. |
void |
setTimeBetweenRetries(int aTime)
Sets timeBetweenRetries attribute value. |
void |
terminate()
Frees and closes all the services from the pool. |
java.lang.String |
toString()
Converts this CommonCommunicationsService to a 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 static final java.lang.String COMPID
int indexOfLastSession
int size
long nameIndex
int initialSize
boolean identicalElements
java.util.Vector pool
java.lang.Object poolSem
int maxPoolSize
long timeBetweenRetries
int cleanupTime
int requestsCount
int maxConcurrents
int spare
Semaphore sem
Constructor Detail |
---|
public CommunicationsPool()
public CommunicationsPool(java.lang.String aName) throws java.io.IOException
aName
- java.lang.String - Communications pool service name.
java.io.IOException.
java.io.IOException
Method Detail |
---|
public boolean areAllServicesOffline()
areAllServicesOffline
in interface CommunicationsPoolService
public void closeAll()
closeAll
in interface CommunicationsPoolService
protected void freeAll()
public CommonCommunicationsService getPoolService()
getPoolService
in interface CommunicationsPoolService
protected CommonCommunicationsService getSessionWithName(java.lang.String name)
name
- String - The name of the service to be returned
public java.lang.Object initializeFrom(Tag aTag) throws java.io.IOException, DSEInvalidArgumentException, DSEException
initializeFrom
in class Service
aTag
- Tag, the Tag
java.io.IOException
DSEInvalidArgumentException
DSEException
public void initInstance() throws DSEException
DSEException
public void insertService(CommonCommunicationsService aService)
insertService
in interface CommunicationsPoolService
aService
- com.ibm.btt.services.comms.CommonCommunicationsService - The service to be added to the poolpublic boolean isThreadIsAlive()
public void openAll()
openAll
in interface CommunicationsPoolService
public void releasePoolService(CommonCommunicationsService aService)
releasePoolService
in interface CommunicationsPoolService
aService
- com.ibm.btt.services.comms.CommonCommunicationsService - The service to be releasedprotected void removeAll()
public void releaseAndRemovePoolService(CommonCommunicationsService aService)
aService
- public void removeService(CommonCommunicationsService aService)
removeService
in interface CommunicationsPoolService
aService
- com.ibm.btt.services.comms.CommonCommunicationsService - The service to be removedpublic void run()
run
in interface java.lang.Runnable
public void terminate()
terminate
in interface ProcessorNotifier
terminate
in interface CommunicationsPoolService
terminate
in class Service
public java.lang.String toString()
toString
in class Service
public int getCleanupTime()
getCleanupTime
in interface CommunicationsPoolService
public boolean getIdenticalElements()
getIdenticalElements
in interface CommunicationsPoolService
public int getMaxPoolSize()
getMaxPoolSize
in interface CommunicationsPoolService
public int getSize()
getSize
in interface CommunicationsPoolService
public int getSpare()
getSpare
in interface CommunicationsPoolService
public Tag getTag()
getTag
in interface CommunicationsPoolService
public long getTimeBetweenRetries()
getTimeBetweenRetries
in interface CommunicationsPoolService
public void setCleanupTime(int aTime)
setCleanupTime
in interface CommunicationsPoolService
public void setIdenticalElements(boolean aBoolean)
setIdenticalElements
in interface CommunicationsPoolService
public void setMaxPoolSize(int aMaxPoolSize)
setMaxPoolSize
in interface CommunicationsPoolService
public void setSize(int aSize)
setSize
in interface CommunicationsPoolService
public void setSpare(int aSpare)
setSpare
in interface CommunicationsPoolService
public void setTag(Tag aTag)
setTag
in interface CommunicationsPoolService
public void setTimeBetweenRetries(int aTime)
setTimeBetweenRetries
in interface CommunicationsPoolService
public int getRequestsCount()
|
IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |