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,
boolean sharable)
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
|
ConnectionListener |
findConnectionListener(javax.resource.spi.ManagedConnection mc)
Find a connection listener
|
ConnectionListener |
findConnectionListener(javax.resource.spi.ManagedConnection mc,
java.lang.Object connection)
Find a connection listener
|
void |
flush()
Flush idle connections from the pool
|
void |
flush(boolean kill)
Flush the pool
|
void |
flush(FlushMode mode)
Flush the pool
|
Capacity |
getCapacity()
Get the capacity policy
|
ConnectionListener |
getConnection(javax.transaction.Transaction trackByTransaction,
javax.security.auth.Subject subject,
javax.resource.spi.ConnectionRequestInfo cri)
Get a connection
|
protected ConnectionManager |
getConnectionManager()
Get the connection manager
|
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.
|
protected java.util.concurrent.ConcurrentMap<java.lang.Object,ManagedConnectionPool> |
getManagedConnectionPools()
Get the managed connection pools.
|
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.resource.spi.ConnectionRequestInfo cri,
javax.security.auth.Subject subject)
Test if a connection can be obtained
|
boolean |
isFIFO()
Is the pool a FIFO or FILO pool
|
boolean |
isSharable()
Is sharable
|
boolean |
isShutdown()
Is shutdown
|
void |
returnConnection(ConnectionListener cl,
boolean kill)
Return a connection
|
void |
setCapacity(Capacity c)
Set the capacity policy
|
void |
setConnectionManager(ConnectionManager cm)
Set the connection manager
|
void |
setName(java.lang.String poolName)
Sets pool name.
|
void |
shutdown()
Shutdown the pool
|
abstract boolean |
testConnection()
Test if a connection can be obtained
|
abstract boolean |
testConnection(javax.resource.spi.ConnectionRequestInfo cri,
javax.security.auth.Subject subject)
Test if a connection can be obtained
|
protected final CoreLogger log
protected AbstractPool(javax.resource.spi.ManagedConnectionFactory mcf, PoolConfiguration pc, boolean noTxSeparatePools, boolean sharable)
mcf
- the managed connection factorypc
- the pool configurationnoTxSeparatePools
- noTxSeparatePoolsharable
- Are the connections sharablepublic void setName(java.lang.String poolName)
poolName
- pool namepublic java.lang.String getName()
public boolean isSharable()
public Capacity getCapacity()
public void setCapacity(Capacity c)
c
- The valuepublic boolean isFIFO()
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 void flush(FlushMode mode)
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 ConnectionListener findConnectionListener(javax.resource.spi.ManagedConnection mc)
mc
- The managed connectionpublic ConnectionListener findConnectionListener(javax.resource.spi.ManagedConnection mc, java.lang.Object connection)
mc
- The managed connectionconnection
- The connectionpublic 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 ConnectionManager getConnectionManager()
public void setConnectionManager(ConnectionManager cm)
cm
- the connection managerpublic boolean isShutdown()
public void shutdown()
public PoolStatistics getStatistics()
getStatistics
in interface Pool
public abstract boolean testConnection()
testConnection
in interface Pool
public abstract boolean testConnection(javax.resource.spi.ConnectionRequestInfo cri, javax.security.auth.Subject subject)
testConnection
in interface Pool
cri
- Optional connection request info objectsubject
- Optional subjectprotected boolean internalTestConnection(javax.resource.spi.ConnectionRequestInfo cri, javax.security.auth.Subject subject)
subject
- Optional subjectcri
- Optional CRIprotected java.util.concurrent.ConcurrentMap<java.lang.Object,ManagedConnectionPool> getManagedConnectionPools()
public abstract CoreLogger getLogger()
Copyright © 2013 IronJacamar (http://www.ironjacamar.org)