| java.lang.Object org.ofbiz.minerva.pool.jdbc.xa.wrapper.XAConnectionImpl
XAConnectionImpl | public class XAConnectionImpl implements XAConnection,PooledObject(Code) | | A transaction wrapper around a java.sql.Connection. This provides access to
an XAResource (there is a one-to-one mapping between XAResource and
XAConnection) and a java.sql.Connection (in this implementation, there is
also a one-to-one mapping between XAConnection and java.sql.Connection).
In order to pool java.sql.Connections in a transactional environment, this
is the class that should be pooled - though you could pool the connections,
there is no need to create and destroy these wrappers so frequently.
Note that there con only be one transaction at a time accessing one of
these wrappers, and requests to a pool for multiple connections on behalf of
one transaction should use the same wrapper. This is because there is no
distinction between connections and transactions in a java.sql.Connection,
and work done by one connection on behalf of a transaction would not be
visible to another connection working on behalf of the same transaction - you
would have effectively created two transactions.
This also implies that an XAConnection should not be released to a
connection pool until the work has been committed or rolled back. However,
it must sent the close notification as usual in order to be delisted from
the transaction. So the ConnectionEventListener must not release the
XAConnection to a pool when it receives the close event. Instead, it should
also register a TransactionListener that will be notified when the
Transaction is finished, and release the XAConnection at that time.
See Also: org.ofbiz.minerva.pool.jdbc.xa.wrapper.TransactionListener author: Aaron Mulder (ammulder@alumni.princeton.edu) author: Bill Burke author: REVISIONS: author: 20010703 bill added code for transaction isolation |
XAConnectionImpl | public XAConnectionImpl(Connection con, XAResourceImpl resource, boolean saveStackTrace)(Code) | | Creates a new transactional wrapper.
Parameters: con - The underlying non-transactional Connection. Parameters: resource - The transaction resource used to enlist thisconnection in a transaction. |
clearTransactionListener | public void clearTransactionListener()(Code) | | Clears the transaction listener.
|
clientConnectionClosed | public void clientConnectionClosed(XAClientConnection clientCon)(Code) | | Indicates that the connection given to the client has been closed.
If there is currently a transaction, this object should not be closed or
returned to a pool. If not, it can be closed or returned immediately.
|
close | public void close()(Code) | | Shuts down this wrapper (and the underlying Connection) permanently.
|
firePoolEvent | void firePoolEvent(PoolEvent evt)(Code) | | Dispatches an event to the pool event listeners.
|
forceClientConnectionsClose | public void forceClientConnectionsClose()(Code) | | |
getPSCacheSize | public int getPSCacheSize()(Code) | | Gets the number of PreparedStatements to be cached for each
Connection.
|
getPassword | public java.lang.String getPassword()(Code) | | Getter for property password.
Value of property password. |
rollback | public void rollback() throws SQLException(Code) | | Rolls back the underlying connection. This is used when there is no
current transaction and the connection is returned to the pool - since
no transaction will be committed or rolled back but this connection
will be reused, we must roll it back. This is only done if autocommit is
false.
|
setConnectionError | public void setConnectionError(SQLException e)(Code) | | Indicates that the connection given to the client has had an error.
If there is currently a transaction, this object should not be closed or
returned to a pool. If not, it can be closed or returned immediately.
|
setPSCacheSize | public void setPSCacheSize(int maxSize)(Code) | | Sets the number of PreparedStatements to be cached for each
Connection. Your DB product may impose a limit on the number
of open PreparedStatements.
|
setPassword | public void setPassword(java.lang.String password)(Code) | | Setter for property password.
Parameters: password - New value of property password. |
setTransactionIsolation | public void setTransactionIsolation(int iso) throws SQLException(Code) | | |
setUser | public void setUser(java.lang.String user)(Code) | | Setter for property user.
Parameters: user - New value of property user. |
transactionFailed | public void transactionFailed()(Code) | | Indicates that the outstanding transaction has finished with a fatal
error, and this object should be closed or permanently removed from a
pool. This dispatches a close event to all listeners.
See Also: XAConnectionImpl.addConnectionEventListener |
transactionFinished | public void transactionFinished()(Code) | | Indicates that the outstanding transaction has finished and this object
can be closed or returned to a pool. This dispatches a close event to
all listeners.
See Also: XAConnectionImpl.addConnectionEventListener |
|
|