org.slim3.datasource
Class XAConnectionImpl

java.lang.Object
  extended by org.slim3.datasource.XAConnectionImpl
All Implemented Interfaces:
PooledConnection, XAConnection

public class XAConnectionImpl
extends Object
implements XAConnection

An implementation class for XAConnection.

Since:
3.0
Author:
higa

Field Summary
protected  AtomicBoolean closed
          Whether this connection is closed.
protected  List<ConnectionEventListener> listeners
          The list for ConnectionEventListener.
protected static Log log
          The log.
protected  Connection physicalConnection
          The physical connection.
protected  boolean transactional
          Whether this connection is transactional.
protected  XAResourceImpl xaResource
          The XA resource.
 
Constructor Summary
XAConnectionImpl(Connection physicalConnection)
          Constructor.
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
           
 void close()
           
 Connection getConnection()
           
 Connection getPhysicalConnection()
          Returns the physical connection.
 XAResource getXAResource()
           
 boolean isClosed()
          Determines if this connection is closed.
 boolean isTransactional()
          Determines if this connection is transactional.
 void notifyConnectionClosed()
          Notifies listeners that the logical connection is closed.
 void notifyConnectionErrorOccurred(SQLException error)
          Notifies listeners that a error has occurred.
 void removeConnectionEventListener(ConnectionEventListener listener)
           
 void setTransactional(boolean transactional)
          Sets the transactional flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Log log
The log.


physicalConnection

protected final Connection physicalConnection
The physical connection.


xaResource

protected final XAResourceImpl xaResource
The XA resource.


listeners

protected List<ConnectionEventListener> listeners
The list for ConnectionEventListener.


transactional

protected boolean transactional
Whether this connection is transactional.


closed

protected AtomicBoolean closed
Whether this connection is closed.

Constructor Detail

XAConnectionImpl

public XAConnectionImpl(Connection physicalConnection)
Constructor.

Parameters:
physicalConnection - the physical connection
Method Detail

getXAResource

public XAResource getXAResource()
Specified by:
getXAResource in interface XAConnection

getPhysicalConnection

public Connection getPhysicalConnection()
Returns the physical connection.

Returns:
the physical connection

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface PooledConnection
Throws:
SQLException

isClosed

public boolean isClosed()
Determines if this connection is closed.

Returns:
whether this connection is closed

close

public void close()
           throws SQLException
Specified by:
close in interface PooledConnection
Throws:
SQLException

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)
Specified by:
addConnectionEventListener in interface PooledConnection

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Specified by:
removeConnectionEventListener in interface PooledConnection

notifyConnectionClosed

public void notifyConnectionClosed()
Notifies listeners that the logical connection is closed.


notifyConnectionErrorOccurred

public void notifyConnectionErrorOccurred(SQLException error)
Notifies listeners that a error has occurred.

Parameters:
error - the connection error

isTransactional

public boolean isTransactional()
Determines if this connection is transactional.

Returns:
whether this connection is transactional

setTransactional

public void setTransactional(boolean transactional)
Sets the transactional flag.

Parameters:
transactional - the transactional flag


Copyright © 2008-2009 The Slim3 project. All Rights Reserved.