com.atomikos.datasource.pool
Class ConnectionPool

java.lang.Object
  extended by com.atomikos.datasource.pool.ConnectionPool
All Implemented Interfaces:
XPooledConnectionEventListener

public class ConnectionPool
extends Object
implements XPooledConnectionEventListener


Field Summary
static int DEFAULT_MAINTENANCE_INTERVAL
           
 
Constructor Summary
ConnectionPool(ConnectionFactory connectionFactory, ConnectionPoolProperties properties)
           
 
Method Summary
 int availableSize()
          The amount of pooled connections in state available.
 Reapable borrowConnection(HeuristicMessage hmsg)
          Borrows a connection from the pool.
 void destroy()
           
 void onXPooledConnectionTerminated(XPooledConnection connection)
          fired when a connection changed its state to terminated
 String toString()
           
 int totalSize()
          The total amount of pooled connections in any state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MAINTENANCE_INTERVAL

public static final int DEFAULT_MAINTENANCE_INTERVAL
See Also:
Constant Field Values
Constructor Detail

ConnectionPool

public ConnectionPool(ConnectionFactory connectionFactory,
                      ConnectionPoolProperties properties)
               throws ConnectionPoolException
Throws:
ConnectionPoolException
Method Detail

borrowConnection

public Reapable borrowConnection(HeuristicMessage hmsg)
                          throws CreateConnectionException,
                                 PoolExhaustedException,
                                 ConnectionPoolException
Borrows a connection from the pool.

Parameters:
hmsg - The heuristic message to get the connection with.
Returns:
The connection as Reapable.
Throws:
CreateConnectionException - If the pool attempted to grow but failed.
PoolExhaustedException - If the pool could not grow because it is exhaused.
ConnectionPoolException - Other errors.

destroy

public void destroy()

availableSize

public int availableSize()
The amount of pooled connections in state available.

Returns:
the amount of pooled connections in state available.

totalSize

public int totalSize()
The total amount of pooled connections in any state.

Returns:
the total amount of pooled connections in any state

onXPooledConnectionTerminated

public void onXPooledConnectionTerminated(XPooledConnection connection)
Description copied from interface: XPooledConnectionEventListener
fired when a connection changed its state to terminated

Specified by:
onXPooledConnectionTerminated in interface XPooledConnectionEventListener

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.