org.jboss.jca.core.connectionmanager.pool.mcp
Class ArrayBlockingQueueManagedConnectionPool

java.lang.Object
  extended by org.jboss.jca.core.connectionmanager.pool.mcp.ArrayBlockingQueueManagedConnectionPool
All Implemented Interfaces:
IdleConnectionRemovalSupport, ManagedConnectionPool

public class ArrayBlockingQueueManagedConnectionPool
extends Object
implements ManagedConnectionPool

A managed connection pool implementation using ArrayBlockingQueue

Author:
Jesper Pedersen

Constructor Summary
ArrayBlockingQueueManagedConnectionPool()
          Constructor
 
Method Summary
 void fillToMin()
          Fill to min
 void flush()
          Flush idle connections
 void flush(boolean kill)
          Flush
 int getActive()
          Get number of active connections
 ConnectionListener getConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Returns a connection listener that wraps managed connection.
 ManagedConnectionPoolStatistics getStatistics()
          Get statistics
 void initialize(javax.resource.spi.ManagedConnectionFactory mcf, ConnectionListenerFactory clf, Subject subject, javax.resource.spi.ConnectionRequestInfo cri, org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration pc, Pool p)
          Initialize the managed connection pool
 boolean isEmpty()
          Checks if the pool is empty or not
 boolean isFull()
          Is the pool full ?
 boolean isIdle()
          Is the pool idle ?
 boolean isRunning()
          Checks if the pool is running or not
 void reenable()
          Reenable a pool
 void removeIdleConnections()
          Pool removes idle connections.
 void returnConnection(ConnectionListener cl, boolean kill)
          Return connection to the pool.
 void shutdown()
          Shutdown
 String toString()
          String representation
 void validateConnections()
          Validate connecitons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayBlockingQueueManagedConnectionPool

public ArrayBlockingQueueManagedConnectionPool()
Constructor

Method Detail

initialize

public void initialize(javax.resource.spi.ManagedConnectionFactory mcf,
                       ConnectionListenerFactory clf,
                       Subject subject,
                       javax.resource.spi.ConnectionRequestInfo cri,
                       org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration pc,
                       Pool p)
Initialize the managed connection pool

Specified by:
initialize in interface ManagedConnectionPool
Parameters:
mcf - The managed connection factory
clf - The connection listener factory
subject - The subject
cri - The connection request info
pc - The pool configuration
p - The pool

isRunning

public boolean isRunning()
Checks if the pool is running or not

Specified by:
isRunning in interface ManagedConnectionPool
Returns:
True if is running; otherwise false

isEmpty

public boolean isEmpty()
Checks if the pool is empty or not

Specified by:
isEmpty in interface ManagedConnectionPool
Returns:
True if is emtpy; otherwise false

isFull

public boolean isFull()
Is the pool full ?

Specified by:
isFull in interface ManagedConnectionPool
Returns:
True if full, otherwise false

isIdle

public boolean isIdle()
Is the pool idle ?

Specified by:
isIdle in interface ManagedConnectionPool
Returns:
True if idle, otherwise false

getActive

public int getActive()
Get number of active connections

Specified by:
getActive in interface ManagedConnectionPool
Returns:
The value

reenable

public void reenable()
Reenable a pool

Specified by:
reenable in interface ManagedConnectionPool

getConnection

public ConnectionListener getConnection(Subject subject,
                                        javax.resource.spi.ConnectionRequestInfo cri)
                                 throws javax.resource.ResourceException
Returns a connection listener that wraps managed connection.

Specified by:
getConnection in interface ManagedConnectionPool
Parameters:
subject - subject
cri - connection request info
Returns:
connection listener wrapped managed connection
Throws:
javax.resource.ResourceException - exception

returnConnection

public void returnConnection(ConnectionListener cl,
                             boolean kill)
Return connection to the pool.

Specified by:
returnConnection in interface ManagedConnectionPool
Parameters:
cl - connection listener
kill - kill connection

flush

public void flush()
Flush idle connections

Specified by:
flush in interface ManagedConnectionPool

flush

public void flush(boolean kill)
Flush

Specified by:
flush in interface ManagedConnectionPool
Parameters:
kill - Kill all connections

removeIdleConnections

public void removeIdleConnections()
Pool removes idle connections.

Specified by:
removeIdleConnections in interface IdleConnectionRemovalSupport

shutdown

public void shutdown()
Shutdown

Specified by:
shutdown in interface ManagedConnectionPool

fillToMin

public void fillToMin()
Fill to min

Specified by:
fillToMin in interface ManagedConnectionPool

getStatistics

public ManagedConnectionPoolStatistics getStatistics()
Get statistics

Specified by:
getStatistics in interface ManagedConnectionPool
Returns:
The module

validateConnections

public void validateConnections()
                         throws Exception
Validate connecitons.

Specified by:
validateConnections in interface ManagedConnectionPool
Throws:
Exception - for exception

toString

public String toString()
String representation

Overrides:
toString in class Object
Returns:
The string


Copyright © 2012 JBoss, by Red Hat (http://www.jboss.org/ironjacamar)