public abstract class AbstractPool extends java.lang.Object implements Pool
It can contains sub-pools according to the semantic of
the pool. Concrete implementatins override getKey(Subject, ConnectionRequestInfo, boolean)
method to create map key object.
| Modifier and Type | Field and Description |
|---|---|
protected CoreLogger |
log
The logger
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPool(javax.resource.spi.ManagedConnectionFactory mcf,
PoolConfiguration pc,
boolean noTxSeparatePools)
Create a new base pool.
|
| Modifier and Type | Method and Description |
|---|---|
void |
emptyManagedConnectionPool(ManagedConnectionPool pool)
Remove the matching managed connection pool if the pool is empty
|
void |
flush()
Flush idle connections from the pool
|
void |
flush(boolean kill)
Flush the pool
|
ConnectionListener |
getConnection(javax.transaction.Transaction trackByTransaction,
javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cri)
Get a connection
|
protected ConnectionListenerFactory |
getConnectionListenerFactory()
Get the connection listener factory
|
protected abstract java.lang.Object |
getKey(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cri,
boolean separateNoTx)
Retrieve the key for this request.
|
abstract CoreLogger |
getLogger()
Get the logger
|
javax.resource.spi.ManagedConnectionFactory |
getManagedConnectionFactory()
Retrieve the managed connection factory for this pool.
|
protected ManagedConnectionPool |
getManagedConnectionPool(java.lang.Object key,
javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cri)
Determine the correct pool for this request,
creates a new one when necessary.
|
java.lang.String |
getName()
Gets pool name.
|
PoolStatistics |
getStatistics()
Get the statistics
|
protected TransactionIntegration |
getTransactionIntegration()
Get any transaction integration associated with the pool.
|
protected javax.transaction.TransactionManager |
getTransactionManager()
Get any transaction manager associated with the pool.
|
protected javax.transaction.TransactionSynchronizationRegistry |
getTransactionSynchronizationRegistry()
Get any transaction synchronization registry associated with the pool.
|
protected boolean |
internalTestConnection(javax.security.auth.Subject subject)
Test if a connection can be obtained
|
void |
returnConnection(ConnectionListener cl,
boolean kill)
Return a connection
|
void |
setConnectionListenerFactory(ConnectionListenerFactory clf)
Set the connection listener factory.
|
void |
setName(java.lang.String poolName)
Sets pool name.
|
void |
shutdown()
Shutdown the pool
|
abstract boolean |
testConnection()
Test if a connection can be obtained
|
protected final CoreLogger log
protected AbstractPool(javax.resource.spi.ManagedConnectionFactory mcf,
PoolConfiguration pc,
boolean noTxSeparatePools)
mcf - the managed connection factorypc - the pool configurationnoTxSeparatePools - noTxSeparatePoolpublic void setName(java.lang.String poolName)
poolName - pool namepublic java.lang.String getName()
protected abstract java.lang.Object getKey(javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cri,
boolean separateNoTx)
throws javax.resource.ResourceException
subject - the subjectcri - the connection request informationseparateNoTx - separateNoTxjavax.resource.ResourceException - for any errorprotected ManagedConnectionPool getManagedConnectionPool(java.lang.Object key, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
key - the key to the poolsubject - the subject of the poolcri - the connection request infojavax.resource.ResourceException - for any errorprotected TransactionIntegration getTransactionIntegration()
protected javax.transaction.TransactionManager getTransactionManager()
protected javax.transaction.TransactionSynchronizationRegistry getTransactionSynchronizationRegistry()
public void emptyManagedConnectionPool(ManagedConnectionPool pool)
pool - The poolpublic void flush()
public void flush(boolean kill)
public ConnectionListener getConnection(javax.transaction.Transaction trackByTransaction, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
trackByTransaction - for transaction stickinesssubject - the subject for connectioncri - the connection request informationjavax.resource.ResourceException - for any errorpublic javax.resource.spi.ManagedConnectionFactory getManagedConnectionFactory()
public void returnConnection(ConnectionListener cl, boolean kill) throws javax.resource.ResourceException
cl - the connection event listener wrapping the connectionkill - whether to destroy the managed connectionjavax.resource.ResourceException - for any errorprotected ConnectionListenerFactory getConnectionListenerFactory()
public void setConnectionListenerFactory(ConnectionListenerFactory clf)
clf - the connection event listener factorypublic void shutdown()
public PoolStatistics getStatistics()
getStatistics in interface Poolpublic abstract boolean testConnection()
testConnection in interface Poolprotected boolean internalTestConnection(javax.security.auth.Subject subject)
subject - Optional subjectpublic abstract CoreLogger getLogger()
Copyright ? 2008-2009 Red Hat Middleware LLC (http://www.jboss.com/)