com.atomikos.datasource.pool
Class AbstractXPooledConnection

java.lang.Object
  extended by com.atomikos.datasource.pool.AbstractXPooledConnection
All Implemented Interfaces:
XPooledConnection
Direct Known Subclasses:
AtomikosXAPooledConnection

public abstract class AbstractXPooledConnection
extends Object
implements XPooledConnection

Abstract superclass with generic support for XPooledConnection.

Author:
guy

Constructor Summary
protected AbstractXPooledConnection(ConnectionPoolProperties props)
           
 
Method Summary
 boolean canBeRecycledForCallingThread()
          Can the connection be recycled (if not available) for the calling thread?
 Reapable createConnectionProxy(HeuristicMessage hmsg)
          Create a disposable connection object that acts a controller for the pooled connection.
protected abstract  Reapable doCreateConnectionProxy(HeuristicMessage hmsg)
           
protected  void fireOnXPooledConnectionTerminated()
           
protected  Reapable getCurrentConnectionProxy()
           
protected  int getDefaultIsolationLevel()
           
 long getLastTimeAcquired()
          Get the last time the connection was acquired.
 long getLastTimeReleased()
          Get the last time the connection was released, i.e.
protected  String getTestQuery()
           
 void reap()
          Invalidates (i.e., forces close) of the current connection proxy This does not mean that the connection can be reused immediately: pending transactions may exist that need to terminate.
 void registerXPooledConnectionEventListener(XPooledConnectionEventListener listener)
           
protected abstract  void testUnderlyingConnection()
           
 void unregisterXPooledConnectionEventListener(XPooledConnectionEventListener listener)
           
protected  void updateLastTimeAcquired()
           
protected  void updateLastTimeReleased()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atomikos.datasource.pool.XPooledConnection
destroy, isAvailable, isErroneous
 

Constructor Detail

AbstractXPooledConnection

protected AbstractXPooledConnection(ConnectionPoolProperties props)
Method Detail

getLastTimeAcquired

public long getLastTimeAcquired()
Description copied from interface: XPooledConnection
Get the last time the connection was acquired.

Specified by:
getLastTimeAcquired in interface XPooledConnection
Returns:

getLastTimeReleased

public long getLastTimeReleased()
Description copied from interface: XPooledConnection
Get the last time the connection was released, i.e. the last time when it has become available.

Specified by:
getLastTimeReleased in interface XPooledConnection
Returns:

createConnectionProxy

public Reapable createConnectionProxy(HeuristicMessage hmsg)
                               throws CreateConnectionException
Description copied from interface: XPooledConnection
Create a disposable connection object that acts a controller for the pooled connection. What exactly a connection object is depends on the implementation.

Specified by:
createConnectionProxy in interface XPooledConnection
Parameters:
hmsg - The heuristic message to show in the logs.
Returns:
Throws:
CreateConnectionException

reap

public void reap()
Description copied from interface: XPooledConnection
Invalidates (i.e., forces close) of the current connection proxy This does not mean that the connection can be reused immediately: pending transactions may exist that need to terminate. In other words: this acts as a forced close on the proxy.

Specified by:
reap in interface XPooledConnection

registerXPooledConnectionEventListener

public void registerXPooledConnectionEventListener(XPooledConnectionEventListener listener)
Specified by:
registerXPooledConnectionEventListener in interface XPooledConnection

unregisterXPooledConnectionEventListener

public void unregisterXPooledConnectionEventListener(XPooledConnectionEventListener listener)
Specified by:
unregisterXPooledConnectionEventListener in interface XPooledConnection

fireOnXPooledConnectionTerminated

protected void fireOnXPooledConnectionTerminated()

getTestQuery

protected String getTestQuery()

updateLastTimeReleased

protected void updateLastTimeReleased()

updateLastTimeAcquired

protected void updateLastTimeAcquired()

getCurrentConnectionProxy

protected Reapable getCurrentConnectionProxy()

canBeRecycledForCallingThread

public boolean canBeRecycledForCallingThread()
Description copied from interface: XPooledConnection
Can the connection be recycled (if not available) for the calling thread?

Specified by:
canBeRecycledForCallingThread in interface XPooledConnection
Returns:

getDefaultIsolationLevel

protected int getDefaultIsolationLevel()

doCreateConnectionProxy

protected abstract Reapable doCreateConnectionProxy(HeuristicMessage hmsg)
                                             throws CreateConnectionException
Throws:
CreateConnectionException

testUnderlyingConnection

protected abstract void testUnderlyingConnection()
                                          throws CreateConnectionException
Throws:
CreateConnectionException


Copyright © 2011. All Rights Reserved.