| Modifier and Type | Class and Description |
|---|---|
| private static class | XATransactionState.
The implementation of TimerTask to cancel a global transaction. |
| private static class | XATransactionState.
A class used to monitor if the transaction is in the middle of cancelling or cleaning up on an error. |
| Modifier and Type | Field and Description |
|---|---|
| private EmbedXAResource | |
| pack-priv int | associationState
Association state of the transaction. |
| pack-priv XATransactionState. | |
| pack-priv final EmbedConnection | |
| pack-priv final EmbedXAResource | |
| pack-priv boolean | isPrepared
has this transaction been prepared. |
| pack-priv boolean | performTimeoutRollback
Indicates whether this transaction is supposed to be rolled back by timeout. |
| pack-priv int | |
| pack-priv HashMap | suspendedList
When an XAResource suspends a transaction (end(TMSUSPEND)) it must be resumed using the same XAConnection. |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv XATransactionState. | timeoutTask
A timer task scheduled for the time when the transaction will timeout. |
| pack-priv static final int | TRO_DEADLOCK
Rollback-only due to deadlock |
| pack-priv static final int | TRO_FAIL
Rollback-only due to end(TMFAIL) |
| pack-priv static final int | TRO_TIMEOUT
Rollback-only due to timeout |
| pack-priv final XAXactId |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public void | cleanupOnError(Throwable
The original error t)Implements org. Contexts will be passed errors that are caught by the outer system when they are serious enough to require corrective action. |
| pack-priv boolean | |
| private static ModuleFactory | |
| private static TimerFactory | |
| pack-priv synchronized void | scheduleTimeoutTask(long
The number of milliseconds to be elapsed before
the transaction will be rolled back. timeoutMillis)Schedule a timeout task which will rollback the global transaction after the specified time will elapse. |
| pack-priv void | |
| pack-priv synchronized void | xa_commit(boolean
Indicates whether to use one phase commit protocol.
Otherwise two phase commit protocol will be used. onePhase)Commit the global transaction and cancel the timeout task. |
| private void | |
| pack-priv synchronized int | |
| pack-priv synchronized void |
| associatedResource | back to summary |
|---|---|
| private EmbedXAResource associatedResource | |
| associationState | back to summary |
|---|---|
| pack-priv int associationState Association state of the transaction. | |
| cleanupOrCancelMonitor | back to summary |
|---|---|
| pack-priv XATransactionState. | |
| conn | back to summary |
|---|---|
| pack-priv final EmbedConnection conn | |
| creatingResource | back to summary |
|---|---|
| pack-priv final EmbedXAResource creatingResource | |
| isPrepared | back to summary |
|---|---|
| pack-priv boolean isPrepared has this transaction been prepared. | |
| performTimeoutRollback | back to summary |
|---|---|
| pack-priv boolean performTimeoutRollback Indicates whether this transaction is supposed to be rolled back by timeout. | |
| rollbackOnlyCode | back to summary |
|---|---|
| pack-priv int rollbackOnlyCode | |
| suspendedList | back to summary |
|---|---|
| pack-priv HashMap<EmbedXAResource, XATransactionState> suspendedList When an XAResource suspends a transaction (end(TMSUSPEND)) it must be resumed using the same XAConnection. This has been the traditional Cloudscape/Derby behaviour, though there does not seem to be a specific reference to this behaviour in the JTA spec. Note that while the transaction is suspended by this XAResource, another XAResource may join the transaction and suspend it after the join. | |
| T0_NOT_ASSOCIATED | back to summary |
|---|---|
| pack-priv static final int T0_NOT_ASSOCIATED | |
| T1_ASSOCIATED | back to summary |
|---|---|
| pack-priv static final int T1_ASSOCIATED | |
| TC_COMPLETED | back to summary |
|---|---|
| pack-priv static final int TC_COMPLETED | |
| timeoutTask | back to summary |
|---|---|
| pack-priv XATransactionState. A timer task scheduled for the time when the transaction will timeout. | |
| TRO_DEADLOCK | back to summary |
|---|---|
| pack-priv static final int TRO_DEADLOCK Rollback-only due to deadlock | |
| TRO_FAIL | back to summary |
|---|---|
| pack-priv static final int TRO_FAIL Rollback-only due to end(TMFAIL) | |
| TRO_TIMEOUT | back to summary |
|---|---|
| pack-priv static final int TRO_TIMEOUT Rollback-only due to timeout | |
| xid | back to summary |
|---|---|
| pack-priv final XAXactId xid | |
| XATransactionState | back to summary |
|---|---|
| pack-priv XATransactionState(ContextManager cm, EmbedConnection conn, EmbedXAResource resource, XAXactId xid) | |
| cancel | back to summary |
|---|---|
| pack-priv void cancel(String messageId) throws XAException This function is called from the timer task when the transaction times out.
| |
| cleanupOnError | back to summary |
|---|---|
| public void cleanupOnError(Throwable t) Implements org. Doc from org. Contexts will be passed errors that are caught
by the outer system when they are serious enough
to require corrective action. They will be told
what the error is, so that they can react appropriately.
Most of the time, the contexts will react by either
doing nothing or by removing themselves from the
context manager. If there are no other references
to the context, removing itself from the manager
equates to freeing it.
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).
| |
| end | back to summary |
|---|---|
| pack-priv boolean end(EmbedXAResource resource, int flags, boolean endingCurrentXid) throws XAException | |
| getMonitor | back to summary |
|---|---|
| private static ModuleFactory getMonitor() Must be private so that user code can't call this entry point. | |
| getTimerFactory | back to summary |
|---|---|
| private static TimerFactory getTimerFactory() | |
| scheduleTimeoutTask | back to summary |
|---|---|
| pack-priv synchronized void scheduleTimeoutTask(long timeoutMillis) Schedule a timeout task which will rollback the global transaction after the specified time will elapse.
| |
| start | back to summary |
|---|---|
| pack-priv void start(EmbedXAResource resource, int flags) throws XAException | |
| xa_commit | back to summary |
|---|---|
| pack-priv synchronized void xa_commit(boolean onePhase) throws SQLException Commit the global transaction and cancel the timeout task.
| |
| xa_finalize | back to summary |
|---|---|
| private void xa_finalize() This method cancels timeoutTask and assigns 'performTimeoutRollback = false'. | |
| xa_prepare | back to summary |
|---|---|
| pack-priv synchronized int xa_prepare() throws SQLException Prepare the global transaction for commit. | |
| xa_rollback | back to summary |
|---|---|
| pack-priv synchronized void xa_rollback() throws SQLException Rollback the global transaction and cancel the timeout task. | |
| Modifier and Type | Field and Description |
|---|---|
| private XATransactionState |
| Access | Constructor and Description |
|---|---|
| public | CancelXATransactionTask(XATransactionState
the XA state object for the transaction to cancel xaState)Creates the cancellation task to be passed to a timer. |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized boolean | |
| public synchronized void | run()
Implements abstract java. Implements java. Runs the cancel task of the global transaction |
| xaState | back to summary |
|---|---|
| private XATransactionState xaState | |
| CancelXATransactionTask | back to summary |
|---|---|
| public CancelXATransactionTask(XATransactionState xaState) Creates the cancellation task to be passed to a timer.
| |
| cancel | back to summary |
|---|---|
| public synchronized boolean cancel() Overrides java. Doc from java. Cancels this timer task. If the task has been scheduled for one-time execution and has not yet run, or has not yet been scheduled, it will never run. If the task has been scheduled for repeated execution, it will never run again. (If the task is running when this call occurs, the task will run to completion, but will never run again.) Note that calling this method from within the This method may be called repeatedly; the second and subsequent calls have no effect.
| |
| run | back to summary |
|---|---|
| public synchronized void run() Implements abstract java. Implements java. Runs the cancel task of the global transaction | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized boolean | |
| private synchronized boolean |
| cancelThreadId | back to summary |
|---|---|
| private Long cancelThreadId | |
| cleanupThreadId | back to summary |
|---|---|
| private Long cleanupThreadId | |
| CleanupOrCancelMonitor | back to summary |
|---|---|
| private CleanupOrCancelMonitor() | |
| okToCancel | back to summary |
|---|---|
| public synchronized boolean okToCancel() See if it is ok to cancel. It is okay to cancel if the transaction is not cleaning up from an error. The assumption is that if the cleanUpOnError is/has been invoked, then there is no reason for the cancel to be processed as the transaction is going to end (ab)normally.
| |
| okToCleanup | back to summary |
|---|---|
| private synchronized boolean okToCleanup() See if it is ok to cleanup. It is okay to cleanup if the transaction is not cancelling. The assumption is that if the cancel is/has been invoked, then there is no reason to try to mark the transaction as being in error. The transaction will be cancelled in any case.
| |