com.infoengine.connector
Class IeConnectionManager

java.lang.Object
  extended bycom.infoengine.connector.IeConnectionManager
All Implemented Interfaces:
javax.resource.spi.ConnectionEventListener, javax.resource.spi.ConnectionManager, EventListener, Serializable

public class IeConnectionManager
extends Object
implements javax.resource.spi.ConnectionManager, javax.resource.spi.ConnectionEventListener

conneciton manager for the situation where the connector is used outside of a J2EE container ("non-managed application scenario") implements a simple connection pool. the free pool is checked every 30 seconds. idle connections are destroyed after they've been idle for 60 seconds.

See Also:
Serialized Form

Nested Class Summary
(package private)  class IeConnectionManager.FreeCxKey
          used as a key for connections in the free pool, marks the last time a connection was used.
 
Field Summary
private  Hashtable busyHandles
           
private static long EXPIRE_INTERVAL
           
private  Hashtable freeHandles
           
private static long IDLE_TIME
           
private  Log log
           
 
Constructor Summary
(package private) IeConnectionManager(Log l)
          create a new connection manager
 
Method Summary
 Object allocateConnection(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          allocation a new CCI connection
 void connectionClosed(javax.resource.spi.ConnectionEvent event)
          connection closed callback.
 void connectionErrorOccurred(javax.resource.spi.ConnectionEvent event)
          connection error callback.
private  void expire()
          used to remove idle connections from the free pool
 void localTransactionCommitted(javax.resource.spi.ConnectionEvent event)
           
 void localTransactionRolledback(javax.resource.spi.ConnectionEvent event)
           
 void localTransactionStarted(javax.resource.spi.ConnectionEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPIRE_INTERVAL

private static final long EXPIRE_INTERVAL
See Also:
Constant Field Values

IDLE_TIME

private static final long IDLE_TIME
See Also:
Constant Field Values

freeHandles

private Hashtable freeHandles

busyHandles

private Hashtable busyHandles

log

private Log log
Constructor Detail

IeConnectionManager

IeConnectionManager(Log l)
create a new connection manager

Parameters:
l - Log
Method Detail

allocateConnection

public Object allocateConnection(javax.resource.spi.ManagedConnectionFactory mcf,
                                 javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                          throws javax.resource.ResourceException
allocation a new CCI connection

Specified by:
allocateConnection in interface javax.resource.spi.ConnectionManager
Parameters:
mcf - the managed connection factory object
cxRequestInfo - the connection request information
Returns:
Object cci connection
Throws:
javax.resource.ResourceException - if something bad happens...

connectionClosed

public void connectionClosed(javax.resource.spi.ConnectionEvent event)
connection closed callback. when a connection is closed it can be returned to the free connection pool.

Specified by:
connectionClosed in interface javax.resource.spi.ConnectionEventListener
Parameters:
event - the close connection event

connectionErrorOccurred

public void connectionErrorOccurred(javax.resource.spi.ConnectionEvent event)
connection error callback. when a connection error occurs the connection is destroyed and removed from the pools.

Specified by:
connectionErrorOccurred in interface javax.resource.spi.ConnectionEventListener
Parameters:
event - the error event

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

private void expire()
used to remove idle connections from the free pool