org.tranql.connector
Class AbstractManagedConnection<T,U>

java.lang.Object
  extended by org.tranql.connector.AbstractManagedConnection<T,U>
All Implemented Interfaces:
javax.resource.spi.DissociatableManagedConnection, javax.resource.spi.ManagedConnection, ManagedConnectionHandle<T,U>
Direct Known Subclasses:
ManagedPooledConnection, ManagedXAConnection

public abstract class AbstractManagedConnection<T,U>
extends Object
implements javax.resource.spi.ManagedConnection, ManagedConnectionHandle<T,U>, javax.resource.spi.DissociatableManagedConnection

Version:
$Revision: 805 $ $Date: 2010-11-12 00:06:35 +0100 (Fri, 12 Nov 2010) $

Nested Class Summary
protected  class AbstractManagedConnection.LocalTransactionImpl
           
 
Field Summary
protected  javax.resource.spi.ConnectionRequestInfo cri
           
protected  LinkedList<DissociatableConnectionHandle> handles
           
protected  ArrayList<javax.resource.spi.ConnectionEventListener> listeners
           
protected  PrintWriter log
           
protected  javax.resource.spi.ManagedConnectionFactory mcf
           
protected  T physicalConnection
           
protected  Subject subject
           
 
Constructor Summary
AbstractManagedConnection(javax.resource.spi.ManagedConnectionFactory mcf, T physicalConnection, ExceptionSorter exceptionSorter)
           
 
Method Summary
 void addConnectionEventListener(javax.resource.spi.ConnectionEventListener connectionEventListener)
           
 void associateConnection(Object o)
           
protected  void attemptRollback()
           
 void cleanup()
          Default implementation dissociates the connection handles.
protected abstract  void closePhysicalConnection()
           
 void connectionClosed(U handle)
           
 void connectionError(Exception e)
           
 void destroy()
           
 void dissociateConnections()
           
 Object getConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
           
 PrintWriter getLogWriter()
           
 T getPhysicalConnection()
           
protected  void localTransactionCommit(boolean isSPI)
           
protected  void localTransactionRollback(boolean isSPI)
           
protected  void localTransactionStart(boolean isSPI)
           
 void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener connectionEventListener)
           
 void setLogWriter(PrintWriter printWriter)
           
protected  void unfilteredConnectionError(Exception e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tranql.connector.ManagedConnectionHandle
getClientLocalTransaction, matches
 
Methods inherited from interface javax.resource.spi.ManagedConnection
getLocalTransaction, getMetaData, getXAResource
 

Field Detail

mcf

protected final javax.resource.spi.ManagedConnectionFactory mcf

physicalConnection

protected final T physicalConnection

handles

protected final LinkedList<DissociatableConnectionHandle> handles

listeners

protected final ArrayList<javax.resource.spi.ConnectionEventListener> listeners

log

protected PrintWriter log

subject

protected Subject subject

cri

protected javax.resource.spi.ConnectionRequestInfo cri
Constructor Detail

AbstractManagedConnection

public AbstractManagedConnection(javax.resource.spi.ManagedConnectionFactory mcf,
                                 T physicalConnection,
                                 ExceptionSorter exceptionSorter)
Method Detail

getPhysicalConnection

public T getPhysicalConnection()
Specified by:
getPhysicalConnection in interface ManagedConnectionHandle<T,U>

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Default implementation dissociates the connection handles. Sub-classes should override to perform any cleanup needed on the physical connection.

Specified by:
cleanup in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

destroy

public void destroy()
             throws javax.resource.ResourceException
Specified by:
destroy in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

closePhysicalConnection

protected abstract void closePhysicalConnection()
                                         throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

associateConnection

public void associateConnection(Object o)
                         throws javax.resource.ResourceException
Specified by:
associateConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

dissociateConnections

public void dissociateConnections()
                           throws javax.resource.ResourceException
Specified by:
dissociateConnections in interface javax.resource.spi.DissociatableManagedConnection
Throws:
javax.resource.ResourceException

connectionClosed

public void connectionClosed(U handle)
Specified by:
connectionClosed in interface ManagedConnectionHandle<T,U>

connectionError

public void connectionError(Exception e)
Specified by:
connectionError in interface ManagedConnectionHandle<T,U>

attemptRollback

protected void attemptRollback()

unfilteredConnectionError

protected void unfilteredConnectionError(Exception e)

addConnectionEventListener

public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener connectionEventListener)
Specified by:
addConnectionEventListener in interface javax.resource.spi.ManagedConnection

removeConnectionEventListener

public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener connectionEventListener)
Specified by:
removeConnectionEventListener in interface javax.resource.spi.ManagedConnection

getLogWriter

public PrintWriter getLogWriter()
                         throws javax.resource.ResourceException
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

setLogWriter

public void setLogWriter(PrintWriter printWriter)
                  throws javax.resource.ResourceException
Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

localTransactionStart

protected void localTransactionStart(boolean isSPI)
                              throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

localTransactionCommit

protected void localTransactionCommit(boolean isSPI)
                               throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

localTransactionRollback

protected void localTransactionRollback(boolean isSPI)
                                 throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

getConnection

public Object getConnection(Subject subject,
                            javax.resource.spi.ConnectionRequestInfo connectionRequestInfo)
                     throws javax.resource.ResourceException
Specified by:
getConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException


Copyright © 2004-2012 Tranql project committers. All Rights Reserved.