public abstract class ConnectorPool<T extends IConnector> extends Object
| Modifier and Type | Class and Description |
|---|---|
protected class |
ConnectorPool.Pool
This class represents a value in the pool hash, which corresponds to a given key.
|
protected static class |
ConnectorPool.SumClass |
| Modifier and Type | Field and Description |
|---|---|
static String |
_rcsid |
protected Map<String,ConnectorPool.Pool> |
poolHash
Pool hash table.
|
protected static Random |
randomNumberGenerator
Random number
|
protected String |
serviceTypePrefix
Service type prefix
|
protected static String |
targetCalcLockPrefix
Target calc lock prefix
|
| Modifier | Constructor and Description |
|---|---|
protected |
ConnectorPool(String serviceTypePrefix) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildServiceTypeName(String connectionName) |
protected String |
buildTargetCalcLockName(String connectionName) |
void |
closeAllConnectors(IThreadContext threadContext)
Clean up all open output connector handles.
|
protected T |
createConnectorInstance(IThreadContext threadContext,
String className)
Get a connector instance.
|
void |
flushUnusedConnectors(IThreadContext threadContext)
Flush only those connector handles that are currently unused.
|
T |
grab(IThreadContext threadContext,
String connectionName,
String className,
ConfigParams configInfo,
int maxPoolSize)
Get a connector.
|
T[] |
grabMultiple(IThreadContext threadContext,
Class<T> clazz,
String[] orderingKeys,
String[] connectionNames,
String[] classNames,
ConfigParams[] configInfos,
int[] maxPoolSizes)
Get multiple connectors, all at once.
|
protected abstract boolean |
isConnectionNameValid(IThreadContext tc,
String connectionName)
Override this method to check if a connection name is still valid.
|
protected abstract boolean |
isInstalled(IThreadContext tc,
String className)
Override this method to hook into a connector manager.
|
protected static byte[] |
pack(int target,
int inUse) |
void |
pollAllConnectors(IThreadContext threadContext)
Idle notification for inactive output connector handles.
|
void |
release(IThreadContext threadContext,
String connectionName,
T connector)
Release an output connector.
|
void |
releaseMultiple(IThreadContext threadContext,
String[] connectionNames,
T[] connectors)
Release multiple output connectors.
|
protected static int |
unpackInUse(byte[] data) |
protected static int |
unpackTarget(byte[] data) |
public static final String _rcsid
protected static final String targetCalcLockPrefix
protected final String serviceTypePrefix
protected final Map<String,ConnectorPool.Pool> poolHash
protected static final Random randomNumberGenerator
protected ConnectorPool(String serviceTypePrefix)
protected abstract boolean isInstalled(IThreadContext tc, String className) throws ManifoldCFException
ManifoldCFExceptionprotected abstract boolean isConnectionNameValid(IThreadContext tc, String connectionName) throws ManifoldCFException
ManifoldCFExceptionprotected T createConnectorInstance(IThreadContext threadContext, String className) throws ManifoldCFException
className - is the class name.ManifoldCFExceptionpublic T[] grabMultiple(IThreadContext threadContext, Class<T> clazz, String[] orderingKeys, String[] connectionNames, String[] classNames, ConfigParams[] configInfos, int[] maxPoolSizes) throws ManifoldCFException
ManifoldCFExceptionpublic T grab(IThreadContext threadContext, String connectionName, String className, ConfigParams configInfo, int maxPoolSize) throws ManifoldCFException
threadContext - is the current thread context.connectionName - is the name of the connection. This functions as a pool key.className - is the name of the class to get a connector for.configInfo - are the name/value pairs constituting configuration info
for this class.ManifoldCFExceptionpublic void releaseMultiple(IThreadContext threadContext, String[] connectionNames, T[] connectors) throws ManifoldCFException
ManifoldCFExceptionpublic void release(IThreadContext threadContext, String connectionName, T connector) throws ManifoldCFException
connectionName - is the connection name.connector - is the connector to release.ManifoldCFExceptionpublic void pollAllConnectors(IThreadContext threadContext) throws ManifoldCFException
ManifoldCFExceptionpublic void flushUnusedConnectors(IThreadContext threadContext) throws ManifoldCFException
ManifoldCFExceptionpublic void closeAllConnectors(IThreadContext threadContext) throws ManifoldCFException
threadContext - is the local thread context.ManifoldCFExceptionprotected static int unpackTarget(byte[] data)
protected static int unpackInUse(byte[] data)
protected static byte[] pack(int target,
int inUse)