Context
final class XATransactionState extends ContextImpl
Modifier and Type | Class | Description |
---|---|---|
private static class |
XATransactionState.CancelXATransactionTask |
The implementation of TimerTask to cancel a global transaction.
|
private static class |
XATransactionState.CleanupOrCancelMonitor |
A class used to monitor if the transaction is in the middle of
cancelling or cleaning up on an error.
|
Modifier and Type | Field | Description |
---|---|---|
private EmbedXAResource |
associatedResource |
|
(package private) int |
associationState |
Association state of the transaction.
|
(package private) XATransactionState.CleanupOrCancelMonitor |
cleanupOrCancelMonitor |
|
(package private) EmbedConnection |
conn |
|
(package private) EmbedXAResource |
creatingResource |
|
(package private) boolean |
isPrepared |
has this transaction been prepared.
|
(package private) boolean |
performTimeoutRollback |
Indicates whether this transaction is supposed to be rolled back by timeout.
|
(package private) int |
rollbackOnlyCode |
|
(package private) java.util.HashMap<EmbedXAResource,XATransactionState> |
suspendedList |
When an XAResource suspends a transaction (end(TMSUSPEND)) it must be resumed
using the same XAConnection.
|
(package private) static int |
T0_NOT_ASSOCIATED |
|
(package private) static int |
T1_ASSOCIATED |
|
(package private) static int |
TC_COMPLETED |
|
(package private) XATransactionState.CancelXATransactionTask |
timeoutTask |
A timer task scheduled for the time when the transaction will timeout.
|
(package private) static int |
TRO_DEADLOCK |
Rollback-only due to deadlock
|
(package private) static int |
TRO_FAIL |
Rollback-only due to end(TMFAIL)
|
(package private) static int |
TRO_TIMEOUT |
Rollback-only due to timeout
|
(package private) XAXactId |
xid |
Constructor | Description |
---|---|
XATransactionState(ContextManager cm,
EmbedConnection conn,
EmbedXAResource resource,
XAXactId xid) |
Modifier and Type | Method | Description |
---|---|---|
(package private) void |
cancel(java.lang.String messageId) |
This function is called from the timer task when the transaction
times out.
|
void |
cleanupOnError(java.lang.Throwable t) |
Contexts will be passed errors that are caught
by the outer system when they are serious enough
to require corrective action.
|
(package private) boolean |
end(EmbedXAResource resource,
int flags,
boolean endingCurrentXid) |
|
private static ModuleFactory |
getMonitor() |
Privileged Monitor lookup.
|
private static TimerFactory |
getTimerFactory() |
|
(package private) void |
scheduleTimeoutTask(long timeoutMillis) |
Schedule a timeout task which will rollback the global transaction
after the specified time will elapse.
|
(package private) void |
start(EmbedXAResource resource,
int flags) |
|
(package private) void |
xa_commit(boolean onePhase) |
Commit the global transaction and cancel the timeout task.
|
private void |
xa_finalize() |
This method cancels timeoutTask and assigns
'performTimeoutRollback = false'.
|
(package private) int |
xa_prepare() |
Prepare the global transaction for commit.
|
(package private) void |
xa_rollback() |
Rollback the global transaction and cancel the timeout task.
|
appendErrorInfo, getContextManager, getIdName, isLastHandler, popMe, pushMe
static final int TRO_TIMEOUT
static final int TRO_DEADLOCK
static final int TRO_FAIL
static final int T0_NOT_ASSOCIATED
static final int T1_ASSOCIATED
static final int TC_COMPLETED
final EmbedConnection conn
final EmbedXAResource creatingResource
private EmbedXAResource associatedResource
final XAXactId xid
XATransactionState.CleanupOrCancelMonitor cleanupOrCancelMonitor
java.util.HashMap<EmbedXAResource,XATransactionState> suspendedList
int associationState
int rollbackOnlyCode
boolean isPrepared
boolean performTimeoutRollback
XATransactionState.CancelXATransactionTask timeoutTask
XATransactionState(ContextManager cm, EmbedConnection conn, EmbedXAResource resource, XAXactId xid)
private static TimerFactory getTimerFactory()
public void cleanupOnError(java.lang.Throwable t)
Context
Contexts must release all their resources before removing themselves from their context manager.
The context manager will "unwind" the contexts during cleanup in the reverse order they were placed on its global stack.
If error is an instance of StandardException then an implementation of this method may throw a new exception if and only if the new exception is an instance of StandardException that is more severe than the original error or the new exception is a not an instance of StandardException (e.g java.lang.NullPointerException).
void start(EmbedXAResource resource, int flags) throws javax.transaction.xa.XAException
javax.transaction.xa.XAException
boolean end(EmbedXAResource resource, int flags, boolean endingCurrentXid) throws javax.transaction.xa.XAException
javax.transaction.xa.XAException
void scheduleTimeoutTask(long timeoutMillis)
timeoutMillis
- The number of milliseconds to be elapsed before
the transaction will be rolled back.void xa_rollback() throws java.sql.SQLException
java.sql.SQLException
void xa_commit(boolean onePhase) throws java.sql.SQLException
onePhase
- Indicates whether to use one phase commit protocol.
Otherwise two phase commit protocol will be used.java.sql.SQLException
int xa_prepare() throws java.sql.SQLException
java.sql.SQLException
private void xa_finalize()
void cancel(java.lang.String messageId) throws javax.transaction.xa.XAException
javax.transaction.xa.XAException
XATransactionState.CancelXATransactionTask
private static ModuleFactory getMonitor()
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.