jrun.connector
Class ConnectionPool

java.lang.Object
  |
  +--jrunx.pool.ObjectPool
        |
        +--jrun.connector.ConnectionPool
All Implemented Interfaces:
Pool, java.io.Serializable

public class ConnectionPool
extends ObjectPool

ConnectionPool allows JRunConnectionWrapper objects to be pooled through the PoolManager. Create calls ManagedConnectionFactory to get the ManagedConnection object and then wraps it inside JRunConnectionWrapper

Author:
Ramesh Natarajan
See Also:
Serialized Form

Inner Class Summary
static class ConnectionPool.JRunConnectionWrapperFactory
          Create the right kind of wrapper depending on the Transaction support in the metadata
 
Fields inherited from class jrunx.pool.ObjectPool
count, createdLogger, isDefault, lifeguard, locked, logger, metadata, skimmer, unlocked
 
Constructor Summary
ConnectionPool(javax.resource.spi.ManagedConnectionFactory mcf, java.lang.String jndiName, ResourceadapterMetaData resourceAdapterMetaData, ManagedconnectionfactoryInstanceMetaData managedconnectionfactoryInstanceMetaData)
          Create a pool of Objects in which the Objects are created using the default empty constructor.
 
Method Summary
protected  java.lang.Object checkOut(javax.security.auth.Subject subj, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          Checkout calls ManagedConnectionFactory.matchConnections with all the Objects in the pool.
protected  java.lang.Object create()
           
protected  java.lang.Object create(javax.security.auth.Subject subj, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
           
protected  void expire(java.lang.Object o)
          Default expiration invokes PooledObject.closeAllResources()
 JRunConnectionWrapper getJRunManagedConnection(javax.security.auth.Subject thisSubject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          Check if there is a Connection available in the pool Otherwise, call ManagedConnectionFactory.createManagedConnection and return the resulting ManagedConnection Object.
 void init(javax.security.auth.Subject subj)
           
 java.lang.Object requestObject(javax.security.auth.Subject subj, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
           
 void returnObject(java.lang.Object o)
          Subclasses will usually want to override this method, at least for type safety.
protected  boolean validate(java.lang.Object o)
           
 
Methods inherited from class jrunx.pool.ObjectPool
checkIn, checkOut, checkTimeout, cleanUp, closeAllResources, debugMetrics, finalize, getLogger, getPoolname, holdingLock, init, initLogger, isDefault, numCheckedInObjects, numCheckedOutObjects, numTotalObjects, requestObject, setIsDefault, updateLocked
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionPool

public ConnectionPool(javax.resource.spi.ManagedConnectionFactory mcf,
                      java.lang.String jndiName,
                      ResourceadapterMetaData resourceAdapterMetaData,
                      ManagedconnectionfactoryInstanceMetaData managedconnectionfactoryInstanceMetaData)
Create a pool of Objects in which the Objects are created using the default empty constructor.
Method Detail

init

public void init(javax.security.auth.Subject subj)
          throws java.lang.Exception

create

protected java.lang.Object create()
Overrides:
create in class ObjectPool

create

protected java.lang.Object create(javax.security.auth.Subject subj,
                                  javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                           throws java.lang.Exception

getJRunManagedConnection

public JRunConnectionWrapper getJRunManagedConnection(javax.security.auth.Subject thisSubject,
                                                      javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
Check if there is a Connection available in the pool Otherwise, call ManagedConnectionFactory.createManagedConnection and return the resulting ManagedConnection Object. If there is a Connection available in the pool, call matchManagedConnection and return the matched Connection

requestObject

public java.lang.Object requestObject(javax.security.auth.Subject subj,
                                      javax.resource.spi.ConnectionRequestInfo cxRequestInfo)

checkOut

protected java.lang.Object checkOut(javax.security.auth.Subject subj,
                                    javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                             throws java.lang.Exception
Checkout calls ManagedConnectionFactory.matchConnections with all the Objects in the pool. If there are no matching connections, checkOut will create one, unless the client specified amount of objects have already been created, and then it will block until it finds an appropriate object

returnObject

public void returnObject(java.lang.Object o)
Description copied from class: ObjectPool
Subclasses will usually want to override this method, at least for type safety.
Overrides:
returnObject in class ObjectPool

validate

protected boolean validate(java.lang.Object o)
Overrides:
validate in class ObjectPool

expire

protected void expire(java.lang.Object o)
Description copied from class: ObjectPool
Default expiration invokes PooledObject.closeAllResources()
Overrides:
expire in class ObjectPool


Copyright � 2002 Macromedia Corporation. All Rights Reserved.