Class ConnectorPool.Pool
- java.lang.Object
-
- org.apache.manifoldcf.core.connectorpool.ConnectorPool.Pool
-
- Enclosing class:
- ConnectorPool<T extends IConnector>
protected class ConnectorPool.Pool extends java.lang.ObjectThis class represents a value in the pool hash, which corresponds to a given key.
-
-
Field Summary
Fields Modifier and Type Field Description protected intglobalMaxThe global maximum for this poolprotected booleanisAliveWhether this pool is aliveprotected intlocalInUseThe number of instances that are actually connected and in use, as of the last pollprotected intlocalMaxThe number of instances we are allowed to hand out locally, at this timeprotected intnumFreeThe number of local instances we can currently pass out to requesting threads.protected java.lang.StringserviceNameThe (anonymous) service nameprotected java.lang.StringserviceTypeNameService type nameprotected java.util.List<T>stackPlace where we keep unused connector instancesprotected java.lang.StringtargetCalcLockNameThe target calculation lock name
-
Constructor Summary
Constructors Constructor Description Pool(IThreadContext threadContext, int maxCount, java.lang.String connectionName)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflushUnused(IThreadContext threadContext)Flush unused connectors.TgetConnector(IThreadContext threadContext, java.lang.String className, ConfigParams configParams)Grab a connector.voidpollAll(IThreadContext threadContext)Notify all free connectors.voidreleaseAll(IThreadContext threadContext)Release all free connectors.voidreleaseConnector(IThreadContext threadContext, T connector)Release a connector to the pool.voidupdateMaximumPoolSize(IThreadContext threadContext, int maxPoolSize)Update the maximum pool size.
-
-
-
Field Detail
-
isAlive
protected boolean isAlive
Whether this pool is alive
-
globalMax
protected int globalMax
The global maximum for this pool
-
serviceTypeName
protected final java.lang.String serviceTypeName
Service type name
-
serviceName
protected final java.lang.String serviceName
The (anonymous) service name
-
targetCalcLockName
protected final java.lang.String targetCalcLockName
The target calculation lock name
-
stack
protected final java.util.List<T extends IConnector> stack
Place where we keep unused connector instances
-
numFree
protected int numFree
The number of local instances we can currently pass out to requesting threads. Initially zero until pool is apportioned
-
localMax
protected int localMax
The number of instances we are allowed to hand out locally, at this time
-
localInUse
protected int localInUse
The number of instances that are actually connected and in use, as of the last poll
-
-
Constructor Detail
-
Pool
public Pool(IThreadContext threadContext, int maxCount, java.lang.String connectionName) throws ManifoldCFException
Constructor- Throws:
ManifoldCFException
-
-
Method Detail
-
updateMaximumPoolSize
public void updateMaximumPoolSize(IThreadContext threadContext, int maxPoolSize) throws ManifoldCFException
Update the maximum pool size.- Parameters:
maxPoolSize- is the new global maximum pool size.- Throws:
ManifoldCFException
-
getConnector
public T getConnector(IThreadContext threadContext, java.lang.String className, ConfigParams configParams) throws ManifoldCFException
Grab a connector. If none exists, construct it using the information in the pool key.- Returns:
- the connector, or null if no connector could be connected.
- Throws:
ManifoldCFException
-
releaseConnector
public void releaseConnector(IThreadContext threadContext, T connector) throws ManifoldCFException
Release a connector to the pool.- Parameters:
connector- is the connector.- Throws:
ManifoldCFException
-
pollAll
public void pollAll(IThreadContext threadContext) throws ManifoldCFException
Notify all free connectors.- Throws:
ManifoldCFException
-
flushUnused
public void flushUnused(IThreadContext threadContext) throws ManifoldCFException
Flush unused connectors.- Throws:
ManifoldCFException
-
releaseAll
public void releaseAll(IThreadContext threadContext) throws ManifoldCFException
Release all free connectors.- Throws:
ManifoldCFException
-
-