|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.jdbc.EmbedPooledConnection
org.apache.derby.jdbc.EmbedXAConnection
Field Summary | |
protected BrokeredConnection |
currentConnectionHandle
|
(package private) XAXactId |
currentXid
|
protected ReferenceableDataSource |
dataSource
|
protected int |
defaultIsolationLevel
|
(package private) ResourceAdapter |
ra
|
protected EmbedConnection20 |
realConnection
|
Fields inherited from interface javax.transaction.xa.XAResource |
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY |
Constructor Summary | |
(package private) |
EmbedXAConnection(EmbeddedDataSource ds,
ResourceAdapter ra,
java.lang.String u,
java.lang.String p,
boolean requestPassword)
|
Method Summary | |
void |
addConnectionEventListener(javax.sql.ConnectionEventListener listener)
Add an event listener. |
protected void |
checkActive()
|
void |
checkAutoCommit(boolean autoCommit)
Allow control over setting auto commit mode. |
void |
checkCommit()
Allow control over calling commit. |
void |
checkHoldCursors(int holdability)
Are held cursors allowed. |
void |
checkRollback()
Allow control over calling rollback. |
void |
checkSavepoint()
Allow control over creating a Savepoint (JDBC 3.0) |
private void |
checkUserCredentials(EmbedXAConnection original)
|
private void |
checkXAActive()
|
void |
close()
Close the Pooled connection. |
protected void |
closeCurrentConnectionHandle()
In this case the Listeners are *not* notified. |
private static void |
closeUnusedConnection(EmbedConnection20 conn)
Close an underlying connection object when there is no active XAResource to hand it to. |
boolean |
closingConnection()
Close called on BrokeredConnection. |
void |
commit(javax.transaction.xa.Xid xid,
boolean onePhase)
Commit the global transaction specified by xid. |
void |
end(javax.transaction.xa.Xid xid,
int flags)
Ends the work performed on behalf of a transaction branch. |
void |
forget(javax.transaction.xa.Xid xid)
Tell the resource manager to forget about a heuristically completed transaction branch. |
java.sql.Connection |
getConnection()
Create an object handle for a database connection. |
protected java.sql.Connection |
getNewCurrentConnectionHandle()
|
(package private) java.lang.String |
getPassword()
|
java.sql.Connection |
getRealConnection()
Override getRealConnection to create a a local connection when we are not associated with an XA transaction. |
private XATransactionState |
getTransactionState(XAXactId xid_im)
|
int |
getTransactionTimeout()
Obtain the current transaction timeout value set for this XAResource instance. |
(package private) java.lang.String |
getUsername()
|
javax.transaction.xa.XAResource |
getXAResource()
|
boolean |
isSameRM(javax.transaction.xa.XAResource xares)
This method is called to determine if the resource manager instance represented by the target object is the same as the resouce manager instance represented by the parameter xares. |
void |
notifyClose()
|
void |
notifyError(java.sql.SQLException exception)
|
void |
notifyException(java.sql.SQLException sqle)
Notify the control class that a SQLException was thrown during a call on one of the brokered connection's methods. |
protected void |
openRealConnection()
|
int |
prepare(javax.transaction.xa.Xid xid)
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid. |
javax.transaction.xa.Xid[] |
recover(int flag)
Obtain a list of prepared transaction branches from a resource manager. |
void |
removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
Remove an event listener. |
(package private) void |
removeXATransaction(XAXactId xid_im)
|
protected void |
resetRealConnection()
|
private void |
returnConnectionToResource(XATransactionState tranState,
XAXactId xid_im)
Return an underlying connection object back to its XAResource if possible. |
void |
rollback(javax.transaction.xa.Xid xid)
Inform the resource manager to roll back work done on behalf of a transaction branch |
boolean |
setTransactionTimeout(int seconds)
Set the current transaction timeout value for this XAResource instance. |
void |
start(javax.transaction.xa.Xid xid,
int flags)
Start work on behalf of a transaction branch specified in xid If TMJOIN is specified, the start is for joining a transaction previously seen by the resource manager. |
private static javax.transaction.xa.XAException |
wrapInXAException(java.sql.SQLException se)
Map a SQL exception to appropriate XAException. |
private static javax.transaction.xa.XAException |
wrapInXAException(StandardException se)
Map a Standard exception to appropriate XAException. |
java.sql.CallableStatement |
wrapStatement(java.sql.CallableStatement cs,
java.lang.String sql)
Wrap and control a PreparedStatement |
java.sql.PreparedStatement |
wrapStatement(java.sql.PreparedStatement ps,
java.lang.String sql,
java.lang.Object generatedKeys)
Wrap and control a PreparedStatement |
java.sql.Statement |
wrapStatement(java.sql.Statement s)
Wrap and control a Statement |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.sql.PooledConnection |
addConnectionEventListener, close, removeConnectionEventListener |
Field Detail |
final ResourceAdapter ra
XAXactId currentXid
protected EmbedConnection20 realConnection
protected int defaultIsolationLevel
protected BrokeredConnection currentConnectionHandle
protected final ReferenceableDataSource dataSource
Constructor Detail |
EmbedXAConnection(EmbeddedDataSource ds, ResourceAdapter ra, java.lang.String u, java.lang.String p, boolean requestPassword) throws java.sql.SQLException
Method Detail |
public final javax.transaction.xa.XAResource getXAResource() throws java.sql.SQLException
getXAResource
in interface javax.sql.XAConnection
java.sql.SQLException
public final void start(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
start
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifier to be associated with the
resourceflags
- One of TMNOFLAGS, TMJOIN, or TMRESUME
javax.transaction.xa.XAException
- An error has occurred. Possible exceptions are
XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE, XAER_NOTA,
XAER_INVAL, or XAER_PROTO.public final void end(javax.transaction.xa.Xid xid, int flags) throws javax.transaction.xa.XAException
If TMSUSPEND is specified in flags, the transaction branch is temporarily suspended in incomplete state. The transaction context is in suspened state and must be resumed via start with TMRESUME specified.
If TMFAIL is specified, the portion of work has failed. The resource manager may mark the transaction as rollback-only
If TMSUCCESS is specified, the portion of work has completed successfully.
end
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifier that is the same as what was
used previously in the start method.flags
- One of TMSUCCESS, TMFAIL, or TMSUSPEND
javax.transaction.xa.XAException
- An error has occurred.
Possible XAException values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA,
XAER_INVAL, XAER_PROTO, or XA_RB*.public final int prepare(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
prepare
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifier
javax.transaction.xa.XAException
- An error has occurred. Possible exception values
are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
XAER_PROTO.public final void commit(javax.transaction.xa.Xid xid, boolean onePhase) throws javax.transaction.xa.XAException
commit
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifieronePhase
- If true, the resource manager should use a one-phase
commit protocol to commit the work done on behalf of xid.
javax.transaction.xa.XAException
- An error has occurred. Possible XAExceptions are
XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
If the resource manager did not commit the transaction and the paramether onePhase is set to true, the resource manager may throw one of the XA_RB* exceptions. Upon return, the resource manager has rolled back the branch's work and has released all held resources.
public final void rollback(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
rollback
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifier
javax.transaction.xa.XAException
- - An error has occurredpublic final javax.transaction.xa.Xid[] recover(int flag) throws javax.transaction.xa.XAException
recover
in interface javax.transaction.xa.XAResource
flag
- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must
be used when no other flags are set in flags.
javax.transaction.xa.XAException
- An error has occurred. Possible values are
XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.public final void forget(javax.transaction.xa.Xid xid) throws javax.transaction.xa.XAException
forget
in interface javax.transaction.xa.XAResource
xid
- A global transaction identifier
javax.transaction.xa.XAException
- An error has occurred. Possible exception values
are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.public final boolean isSameRM(javax.transaction.xa.XAResource xares) throws javax.transaction.xa.XAException
isSameRM
in interface javax.transaction.xa.XAResource
xares
- An XAResource object whose resource manager instance is to
be compared with the resource manager instance of the target object.
javax.transaction.xa.XAException
- An error has occurred. Possible exception values
are XAER_RMERR, XAER_RMFAIL.public int getTransactionTimeout()
getTransactionTimeout
in interface javax.transaction.xa.XAResource
public boolean setTransactionTimeout(int seconds)
setTransactionTimeout
in interface javax.transaction.xa.XAResource
seconds
- the transaction timeout value in seconds.
javax.transaction.xa.XAException
- - An error has occurred. Possible exception
values are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.public void checkAutoCommit(boolean autoCommit) throws java.sql.SQLException
checkAutoCommit
in interface BrokeredConnectionControl
checkAutoCommit
in class EmbedPooledConnection
java.sql.SQLException
public void checkHoldCursors(int holdability) throws java.sql.SQLException
checkHoldCursors
in interface BrokeredConnectionControl
checkHoldCursors
in class EmbedPooledConnection
java.sql.SQLException
public void checkSavepoint() throws java.sql.SQLException
checkSavepoint
in interface BrokeredConnectionControl
checkSavepoint
in class EmbedPooledConnection
java.sql.SQLException
public void checkRollback() throws java.sql.SQLException
checkRollback
in interface BrokeredConnectionControl
checkRollback
in class EmbedPooledConnection
java.sql.SQLException
public void checkCommit() throws java.sql.SQLException
checkCommit
in interface BrokeredConnectionControl
checkCommit
in class EmbedPooledConnection
java.sql.SQLException
public java.sql.Connection getConnection() throws java.sql.SQLException
EmbedPooledConnection
getConnection
in interface javax.sql.PooledConnection
getConnection
in class EmbedPooledConnection
java.sql.SQLException
- - if a database-access error occurs.public java.sql.Statement wrapStatement(java.sql.Statement s) throws java.sql.SQLException
wrapStatement
in interface BrokeredConnectionControl
wrapStatement
in class EmbedPooledConnection
java.sql.SQLException
public java.sql.PreparedStatement wrapStatement(java.sql.PreparedStatement ps, java.lang.String sql, java.lang.Object generatedKeys) throws java.sql.SQLException
wrapStatement
in interface BrokeredConnectionControl
wrapStatement
in class EmbedPooledConnection
java.sql.SQLException
public java.sql.CallableStatement wrapStatement(java.sql.CallableStatement cs, java.lang.String sql) throws java.sql.SQLException
wrapStatement
in interface BrokeredConnectionControl
wrapStatement
in class EmbedPooledConnection
java.sql.SQLException
public java.sql.Connection getRealConnection() throws java.sql.SQLException
getRealConnection
in interface BrokeredConnectionControl
getRealConnection
in class EmbedPooledConnection
java.sql.SQLException
private XATransactionState getTransactionState(XAXactId xid_im)
private static javax.transaction.xa.XAException wrapInXAException(java.sql.SQLException se)
private static javax.transaction.xa.XAException wrapInXAException(StandardException se)
void removeXATransaction(XAXactId xid_im)
private void returnConnectionToResource(XATransactionState tranState, XAXactId xid_im)
private void checkXAActive() throws javax.transaction.xa.XAException
javax.transaction.xa.XAException
private void checkUserCredentials(EmbedXAConnection original) throws javax.transaction.xa.XAException
javax.transaction.xa.XAException
private static void closeUnusedConnection(EmbedConnection20 conn)
java.lang.String getUsername()
java.lang.String getPassword()
protected final void openRealConnection() throws java.sql.SQLException
java.sql.SQLException
protected final java.sql.Connection getNewCurrentConnectionHandle()
protected void closeCurrentConnectionHandle() throws java.sql.SQLException
java.sql.SQLException
protected void resetRealConnection() throws java.sql.SQLException
java.sql.SQLException
public void close() throws java.sql.SQLException
close
in interface javax.sql.PooledConnection
java.sql.SQLException
- - if a database-access error occurs.public final void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
addConnectionEventListener
in interface javax.sql.PooledConnection
public final void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
removeConnectionEventListener
in interface javax.sql.PooledConnection
public void notifyError(java.sql.SQLException exception)
public void notifyClose()
protected final void checkActive() throws java.sql.SQLException
java.sql.SQLException
public void notifyException(java.sql.SQLException sqle)
notifyException
in interface BrokeredConnectionControl
public boolean closingConnection() throws java.sql.SQLException
closingConnection
in interface BrokeredConnectionControl
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |