tyrex.resource.jdbc

Class ConnectionPool

final class ConnectionPool extends PoolMetrics implements Resource, DataSource, ConnectionEventListener, Runnable

Version: $Revision: 1.21 $

Author: Assaf Arkin

Field Summary
static intAVAILABLE
Flag that signifies that the pooled connection is available
static intCLOSED
Flag that signifies that the connection from the pooled connection has been closed but the pooled connection is not available
static intIN_USE
Flag that signifies that the pooled connection is not available
static intTABLE_SIZE
The initial table size, unless a maximum number of connections is specified.
Category_category
The category used for writing log information.
Constructor Summary
ConnectionPool(String name, PoolLimits limits, ClassLoader loader, XADataSource xaDataSource, ConnectionPoolDataSource poolDataSource, TyrexTransactionManager txManager, Category category)
Method Summary
voidconnectionClosed(ConnectionEvent event)
voidconnectionErrorOccurred(ConnectionEvent event)
voiddestroy()
protected longexpire()
Called periodically to expire connections that have been available in the pool for longer than maxRetain seconds.
ObjectgetClientFactory()
ClassgetClientFactoryClass()
ConnectiongetConnection()
ConnectiongetConnection(String user, String password)
intgetLoginTimeout()
PrintWritergetLogWriter()
PoolLimitsgetPoolLimits()
PoolMetricsgetPoolMetrics()
XAResourcegetXAResource()
booleanrelease(PooledConnection pooled, boolean success)
Releases a connection.
voidrun()
voidsetLoginTimeout(int seconds)
voidsetLogWriter(PrintWriter logWriter)
StringtoString()

Field Detail

AVAILABLE

static final int AVAILABLE
Flag that signifies that the pooled connection is available

CLOSED

static final int CLOSED
Flag that signifies that the connection from the pooled connection has been closed but the pooled connection is not available

IN_USE

static final int IN_USE
Flag that signifies that the pooled connection is not available

TABLE_SIZE

public static final int TABLE_SIZE
The initial table size, unless a maximum number of connections is specified.

_category

final Category _category
The category used for writing log information.

Constructor Detail

ConnectionPool

ConnectionPool(String name, PoolLimits limits, ClassLoader loader, XADataSource xaDataSource, ConnectionPoolDataSource poolDataSource, TyrexTransactionManager txManager, Category category)

Method Detail

connectionClosed

public void connectionClosed(ConnectionEvent event)

connectionErrorOccurred

public void connectionErrorOccurred(ConnectionEvent event)

destroy

public void destroy()

expire

protected long expire()
Called periodically to expire connections that have been available in the pool for longer than maxRetain seconds. This method returns the next expiration time, or zero if no connection is expected to expire soon.

Returns: The next expiration time, or zero if no connection is expected to expire soon.

getClientFactory

public Object getClientFactory()

getClientFactoryClass

public Class getClientFactoryClass()

getConnection

public Connection getConnection()

getConnection

public Connection getConnection(String user, String password)

getLoginTimeout

public int getLoginTimeout()

getLogWriter

public PrintWriter getLogWriter()

getPoolLimits

public PoolLimits getPoolLimits()

getPoolMetrics

public PoolMetrics getPoolMetrics()

getXAResource

public XAResource getXAResource()

release

boolean release(PooledConnection pooled, boolean success)
Releases a connection. The connection is returned to the pool and becomes available for subsequent use.

This method returns true if the connection was used and is now available. It returns false if the connection was not found in the pool.

The XA resource, if available, is delisted from the transaction manager and dissociated from the thread context.

If success is false, it assumes the connection has been released due to an error. There is no need to discard a connection released with an error.

Parameters: pooled The pooled connection to release success True if the connection is useable, false if the connection is released due to an error

Returns: True if the connection has been released

run

public void run()

setLoginTimeout

public void setLoginTimeout(int seconds)

setLogWriter

public void setLogWriter(PrintWriter logWriter)

toString

public String toString()
Original code is Copyright (c) 1999-2001, Intalio, Inc. All Rights Reserved. Contributions by MetaBoss team are Copyright (c) 2003-2005, Softaris Pty. Ltd. All Rights Reserved.