tyrex.resource.jca
Class ConnectionPool

java.lang.Object
  extended bytyrex.resource.PoolMetrics
      extended bytyrex.resource.jca.ConnectionPool
All Implemented Interfaces:
java.util.Collection, javax.resource.spi.ConnectionEventListener, javax.resource.spi.ConnectionManager, java.util.EventListener, Resource, java.lang.Runnable, java.io.Serializable, java.util.Set

final class ConnectionPool
extends PoolMetrics
implements Resource, javax.resource.spi.ConnectionManager, java.util.Set, javax.resource.spi.ConnectionEventListener, java.lang.Runnable

Version:
$Revision: 1.10 $
Author:
Assaf Arkin

Field Summary
static int TABLE_SIZE
          The initial table size, unless a maximum number of connections is specified.
 
Fields inherited from class tyrex.resource.PoolMetrics
_available, _total
 
Constructor Summary
(package private) ConnectionPool(java.lang.String name, PoolLimits limits, ConnectorLoader loader, TyrexTransactionManager txManager, Category category)
           
 
Method Summary
 boolean add(java.lang.Object object)
           
 boolean addAll(java.util.Collection collection)
           
 java.lang.Object allocateConnection(javax.resource.spi.ManagedConnectionFactory factory, javax.resource.spi.ConnectionRequestInfo requestInfo)
           
 void clear()
           
 void connectionClosed(javax.resource.spi.ConnectionEvent event)
           
 void connectionErrorOccurred(javax.resource.spi.ConnectionEvent event)
           
 boolean contains(java.lang.Object object)
           
 boolean containsAll(java.util.Collection collection)
           
 void destroy()
          Called to destory the resource once it is no longer in use.
 boolean equals(java.lang.Object object)
           
protected  long expire()
          Called periodically to expire connections that have been available in the pool for longer than maxRetain seconds.
 java.lang.Object getClientFactory()
          Returns the client connection factory.
 java.lang.Class getClientFactoryClass()
          Returns the client connection factory class.
 PoolLimits getPoolLimits()
          Returns the limits placed on the connection pool.
 PoolMetrics getPoolMetrics()
          Returns the pool metrics.
 javax.transaction.xa.XAResource getXAResource()
          Returns the XA resource interface.
 int hashCode()
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 void localTransactionCommitted(javax.resource.spi.ConnectionEvent event)
           
 void localTransactionRolledback(javax.resource.spi.ConnectionEvent event)
           
 void localTransactionStarted(javax.resource.spi.ConnectionEvent event)
           
 boolean remove(java.lang.Object object)
           
 boolean removeAll(java.util.Collection collection)
           
 boolean retainAll(java.util.Collection collection)
           
 void run()
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] array)
           
 java.lang.String toString()
           
 
Methods inherited from class tyrex.resource.PoolMetrics
getAvailable, getCurrentUnused, getCurrentUsed, getTotal, getTotalCreated, getTotalDiscarded, getTotalErrors, getTotalUsed, getUnusedAvgDuration, getUsedAvgDuration, recordCreated, recordDiscard, recordError, recordUnusedDuration, recordUsedDuration, reset
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TABLE_SIZE

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

See Also:
Constant Field Values
Constructor Detail

ConnectionPool

ConnectionPool(java.lang.String name,
               PoolLimits limits,
               ConnectorLoader loader,
               TyrexTransactionManager txManager,
               Category category)
         throws javax.resource.ResourceException
Method Detail

getPoolMetrics

public PoolMetrics getPoolMetrics()
Description copied from interface: Resource
Returns the pool metrics. The pool metrics object can be used to collect statistical information about the connection pool.

Specified by:
getPoolMetrics in interface Resource
Returns:
The pool metrics

getPoolLimits

public PoolLimits getPoolLimits()
Description copied from interface: Resource
Returns the limits placed on the connection pool. This object can be used to investigate the limits of the connection pool and to change them at run time.

Specified by:
getPoolLimits in interface Resource
Returns:
The limits placed on the connection pool

getClientFactory

public java.lang.Object getClientFactory()
Description copied from interface: Resource
Returns the client connection factory. The client connection factory is enlisted in the JNDI environment naming context for access by the application.

Specified by:
getClientFactory in interface Resource
Returns:
The client connection factory

getClientFactoryClass

public java.lang.Class getClientFactoryClass()
Description copied from interface: Resource
Returns the client connection factory class. This the class or interface that a client connection factory would implement.

Specified by:
getClientFactoryClass in interface Resource
Returns:
The client connection factory class

toString

public java.lang.String toString()

getXAResource

public javax.transaction.xa.XAResource getXAResource()
Description copied from interface: Resource
Returns the XA resource interface. The XA resource is used to manage transaction enlistment and recovery of the resource. This method returns null if the resource does not support XA transactions.

Specified by:
getXAResource in interface Resource
Returns:
The XA resource interface

destroy

public void destroy()
Description copied from interface: Resource
Called to destory the resource once it is no longer in use. After successful return from this method, all open connections are invalidated and no new connections can be obtained from the pool.

The application server must render the connection factory inaccessible to the application before calling this method.

Specified by:
destroy in interface Resource

run

public void run()
Specified by:
run in interface java.lang.Runnable

allocateConnection

public java.lang.Object allocateConnection(javax.resource.spi.ManagedConnectionFactory factory,
                                           javax.resource.spi.ConnectionRequestInfo requestInfo)
                                    throws javax.resource.ResourceException
Specified by:
allocateConnection in interface javax.resource.spi.ConnectionManager
Throws:
javax.resource.ResourceException

connectionClosed

public void connectionClosed(javax.resource.spi.ConnectionEvent event)
Specified by:
connectionClosed in interface javax.resource.spi.ConnectionEventListener

connectionErrorOccurred

public void connectionErrorOccurred(javax.resource.spi.ConnectionEvent event)
Specified by:
connectionErrorOccurred in interface javax.resource.spi.ConnectionEventListener

localTransactionCommitted

public void localTransactionCommitted(javax.resource.spi.ConnectionEvent event)
Specified by:
localTransactionCommitted in interface javax.resource.spi.ConnectionEventListener

localTransactionRolledback

public void localTransactionRolledback(javax.resource.spi.ConnectionEvent event)
Specified by:
localTransactionRolledback in interface javax.resource.spi.ConnectionEventListener

localTransactionStarted

public void localTransactionStarted(javax.resource.spi.ConnectionEvent event)
Specified by:
localTransactionStarted in interface javax.resource.spi.ConnectionEventListener

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.

add

public boolean add(java.lang.Object object)
Specified by:
add in interface java.util.Set

addAll

public boolean addAll(java.util.Collection collection)
Specified by:
addAll in interface java.util.Set

clear

public void clear()
Specified by:
clear in interface java.util.Set

contains

public boolean contains(java.lang.Object object)
Specified by:
contains in interface java.util.Set

containsAll

public boolean containsAll(java.util.Collection collection)
Specified by:
containsAll in interface java.util.Set

equals

public boolean equals(java.lang.Object object)
Specified by:
equals in interface java.util.Set

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Set

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Set

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Set

remove

public boolean remove(java.lang.Object object)
Specified by:
remove in interface java.util.Set

removeAll

public boolean removeAll(java.util.Collection collection)
Specified by:
removeAll in interface java.util.Set

retainAll

public boolean retainAll(java.util.Collection collection)
Specified by:
retainAll in interface java.util.Set

size

public int size()
Specified by:
size in interface java.util.Set

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Set

toArray

public java.lang.Object[] toArray(java.lang.Object[] array)
Specified by:
toArray in interface java.util.Set


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.