Package org.firebirdsql.ds
Class XAConnectionHandler
- java.lang.Object
-
- org.firebirdsql.ds.XAConnectionHandler
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class XAConnectionHandler extends java.lang.ObjectInvocationHandler for the logical connection returned by FBXAConnection.- Since:
- 2.2
- Author:
- Mark Rotteveel
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringCLOSED_MESSAGEprotected java.sql.Connectionconnectionprotected booleanforcedCloseprotected static java.lang.StringFORCIBLY_CLOSED_MESSAGEprotected FBPooledConnectionownerprotected java.sql.Connectionproxy
-
Constructor Summary
Constructors Modifier Constructor Description protectedXAConnectionHandler(java.sql.Connection connection, FBXAConnection owner)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclose()Closes this PooledConnectionHandler.protected voidcloseStatements()protected voidforgetStatement(org.firebirdsql.ds.StatementHandler stmtHandler)protected java.sql.ConnectiongetProxy()protected voidhandleClose(boolean notifyOwner)HandleConnection.close()method.java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)protected booleanisClosed()protected booleanisRollbackAllowed()Method to decide if calling rollback on the physical connection for cleanup (in handleClose()) is allowed.protected voidstatementErrorOccurred(org.firebirdsql.ds.StatementHandler stmtHandler, java.sql.SQLException sqle)
-
-
-
Field Detail
-
CLOSED_MESSAGE
protected static final java.lang.String CLOSED_MESSAGE
- See Also:
- Constant Field Values
-
FORCIBLY_CLOSED_MESSAGE
protected static final java.lang.String FORCIBLY_CLOSED_MESSAGE
- See Also:
- Constant Field Values
-
owner
protected final FBPooledConnection owner
-
connection
protected volatile java.sql.Connection connection
-
proxy
protected volatile java.sql.Connection proxy
-
forcedClose
protected volatile boolean forcedClose
-
-
Constructor Detail
-
XAConnectionHandler
protected XAConnectionHandler(java.sql.Connection connection, FBXAConnection owner)
-
-
Method Detail
-
isRollbackAllowed
protected boolean isRollbackAllowed() throws java.sql.SQLExceptionMethod to decide if calling rollback on the physical connection for cleanup (in handleClose()) is allowed.NOTE: This method is not involved in rollback decisions for calls to the proxy.
- Returns:
truewhen calling rollback is allowed- Throws:
java.sql.SQLException
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
handleClose
protected void handleClose(boolean notifyOwner) throws java.sql.SQLExceptionHandleConnection.close()method. This implementation closes the connection and associated statements.- Parameters:
notifyOwner-truewhen connection owner should be notified of closure.- Throws:
java.sql.SQLException- if underlying connection threw an exception.
-
getProxy
protected java.sql.Connection getProxy()
- Returns:
- Proxy for the Connection object
-
close
protected void close() throws java.sql.SQLExceptionCloses this PooledConnectionHandler. Intended to be called by the ConnectionPoolDataSource when it wants to forcibly close the logical connection to reuse it.- Throws:
java.sql.SQLException
-
isClosed
protected boolean isClosed()
-
statementErrorOccurred
protected void statementErrorOccurred(org.firebirdsql.ds.StatementHandler stmtHandler, java.sql.SQLException sqle)
-
forgetStatement
protected void forgetStatement(org.firebirdsql.ds.StatementHandler stmtHandler)
-
closeStatements
protected void closeStatements() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
-