| org.apache.derby.iapi.store.raw.xact.RawTransaction org.apache.derby.impl.store.raw.xact.Xact
All known Subclasses: org.apache.derby.impl.store.raw.xact.InternalXact,
Xact | public class Xact extends RawTransaction implements Limit(Code) | | A transaction has five states
- CLOSED - cannot be used
- IDLE - no reads have been performed by the transaction.
- ACTIVE - at least one read has been attempted by the transaction
- UPDATE - at least one update has been attempted by the transaction
- PREPARED - the transaction is ready to commit (FUTURE).
Transaction identifiers are re-used for transactions that do not enter the
UPDATE state during their lifetime.
See Also: Transaction |
Method Summary | |
public void | abort() | public long | addAndLoadStreamContainer(long segmentId, Properties tableProperties, RowSource rowSource) | public long | addContainer(long segmentId, long containerid, int mode, Properties tableProperties, int temporaryFlag) | public void | addPostCommitWork(Serviceable work) | public void | addPostTerminationWork(Serviceable work) | public void | addUpdateTransaction(int transactionStatus) Add this to the xactFactory list of update transaction. | public boolean | anyoneBlocked() Return true if any transaction is currently blocked, even if not by
this transaction. | protected void | assumeGlobalXactIdentity(TransactionTableEntry ent) Assume complete identity of the given Transaction Table Entry.
Used by the final phase of the recovery to create new real transactions
to take on the identity of in-doubt prepared transactions found during
redo. | protected void | assumeIdentity(TransactionTableEntry ent) Transform this identity to the one stored in transaction table entry. | public boolean | blockBackup(boolean wait) | public void | checkpointInRollForwardRecovery(LogInstant cinstant, long redoLWM) | public void | close() | public LogInstant | commit() | public LogInstant | commitNoSync(int commitflag) | public void | createXATransactionFromLocalTransaction(int format_id, byte[] global_id, byte[] branch_id) Convert a local transaction to a global transaction.
Must only be called a previous local transaction was created and exists
in the context. | final public LockingPolicy | defaultLockingPolicy() | public void | destroy() If this transaction is not idle, abort it. | protected void | doComplete(Integer commitOrAbort) | protected boolean | doPostCommitWorkInTran() If this is a user transaction (not an internal or nested top
transaction), and this is not already taking care of post
commit work, and not an XA transaction, then take care of hi prioirty
work right now using this thread and this context manager. | public void | dropContainer(ContainerKey containerId) | public void | dropStreamContainer(long segmentId, long containerId) | public String | getActiveStateTxIdString() | public long[] | getCacheStats(String cacheName) | public Object | getCompatibilitySpace() Get the compatibility space of the transaction.
Returns an object that can be used with the lock manager to provide
the compatibility space of a transaction. | final public String | getContextId() | final public ContextManager | getContextManager() | final public DataFactory | getDataFactory() | public LockingPolicy | getDefaultLockingPolicy() Get the current default locking policy for all operations within this
transaction. | public FileResource | getFileHandler() | public LogInstant | getFirstLogInstant() Get the log instant for the first log record written by this transaction. | final public GlobalTransactionId | getGlobalId() | final public TransactionId | getId() | final protected TransactionId | getIdNoCheck() | public LogInstant | getLastLogInstant() Get the log instant for the last log record written by this transaction. | final public LockFactory | getLockFactory() | public DynamicByteArrayOutputStream | getLogBuffer() | String | getState() | public String | getTransName() | public boolean | handlesPostTerminationWork() | public boolean | inAbort() | public boolean | inRollForwardRecovery() | final public boolean | isActive() see if this transaction has ever done anything.
MT - single thread through synchronizing this. | public boolean | isBlockingBackup() | public boolean | isIdle() See if this transaction is in the idle state, called by other thread to
test the state of this transaction. | final public boolean | isPrepared() see if this transaction is in PREPARED state.
MT - single thread through synchronizing this. | public boolean | isPristine() see if this transaction is in a pristine state. | public void | logAndDo(Loggable operation) Log the operation and do it. | public void | logAndUndo(Compensation compensation, LogInstant undoInstant, LimitObjectInput in) Log and apply a compensation operation. | final public LockingPolicy | newLockingPolicy(int mode, int isolation, boolean stricterOk) | public ContainerHandle | openContainer(ContainerKey containerId, int mode) | public ContainerHandle | openContainer(ContainerKey containerId, LockingPolicy locking, int mode) | public RawContainerHandle | openDroppedContainer(ContainerKey containerId, LockingPolicy locking) Open a container that may already have been dropped. | public StreamContainerHandle | openStreamContainer(long segmentId, long containerId, boolean hold) | protected boolean | popSavePoints(int position, boolean release) Pop all savepoints upto the one with the given name and rollback
all changes made since this savepoint was pushed. | protected void | postComplete(int commitflag, Integer commitOrAbort) | protected void | preComplete(Integer commitOrAbort) | public void | prepareTransaction() Remove this from the xactFactory list of update transaction. | public void | reCreateContainerForRedoRecovery(long segmentId, long containerId, ByteArray containerInfo) Recreate a container during redo recovery. | public void | reached(Object compatabilitySpace, Object group, int limit, Enumeration lockList, int lockCount) | public void | recoveryTransaction() | public int | releaseSavePoint(String name, Object kindOfSavepoint) | public void | removeUpdateTransaction() Remove this from the xactFactory list of update transaction. | public void | reprepare() During recovery re-prepare a transaction.
After redo() and undo(), this routine is called on all outstanding
in-doubt (prepared) transactions. | public void | resetCacheStats(String cacheName) | void | resetDefaultLocking() | public int | rollbackToSavePoint(String name, Object kindOfSavepoint) | final protected void | setActiveState() | final public void | setDefaultLockingPolicy(LockingPolicy policy) | public void | setFirstLogInstant(LogInstant instant) Set the log instant for the first log record written by this transaction. | protected void | setIdleState() | public void | setLastLogInstant(LogInstant instant) Set the log instant for the last log record written by this transaction. | void | setPostComplete() Set the transaction to issue pre complete work at postComplete
time, instead of preComplete time. | final protected void | setPrepareState() Move the state of the transaction from UPDATE to PREPARE.
The state transition should only be from UPDATE to PREPARE. | public int | setSavePoint(String name, Object kindOfSavepoint) | public void | setTransName(String name) | public void | setTransactionId(GlobalTransactionId extid, TransactionId localid) Set my transaction identifier. | public void | setTransactionId(Loggable beginXact, TransactionId localId) | public void | setup(PersistentSet set) | public RawTransaction | startNestedTopTransaction() | protected int | statusForBeginXactLog() | protected int | statusForEndXactLog() | public String | toString() Return the xid as a string. | public void | xa_commit(boolean onePhase) This method is called to commit the current XA global transaction. | public int | xa_prepare() This method is called to ask the resource manager to prepare for
a transaction commit of the transaction specified in xid.
A value indicating the resource manager's vote on thethe outcome of the transaction. | public void | xa_rollback() rollback the current global transaction. |
ACTIVE | final protected static int ACTIVE(Code) | | |
CLOSED | final protected static int CLOSED(Code) | | |
END_ABORTED | final public static int END_ABORTED(Code) | | |
END_COMMITTED | final public static int END_COMMITTED(Code) | | |
END_PREPARED | final public static int END_PREPARED(Code) | | |
IDLE | final protected static int IDLE(Code) | | |
INTERNAL_TRANSACTION | final public static int INTERNAL_TRANSACTION(Code) | | |
NESTED_TOP_TRANSACTION | final public static int NESTED_TOP_TRANSACTION(Code) | | |
PREPARED | final protected static int PREPARED(Code) | | |
RECOVERY_ROLLBACK_FIRST | final public static int RECOVERY_ROLLBACK_FIRST(Code) | | |
UPDATE | final protected static int UPDATE(Code) | | |
compatibilitySpace | final protected Object compatibilitySpace(Code) | | |
postCommitWorks | protected List postCommitWorks(Code) | | |
postTerminationWorks | protected List postTerminationWorks(Code) | | |
state | protected volatile int state(Code) | | |
addUpdateTransaction | public void addUpdateTransaction(int transactionStatus)(Code) | | Add this to the xactFactory list of update transaction.
|
anyoneBlocked | public boolean anyoneBlocked()(Code) | | Return true if any transaction is currently blocked, even if not by
this transaction.
|
assumeGlobalXactIdentity | protected void assumeGlobalXactIdentity(TransactionTableEntry ent)(Code) | | Assume complete identity of the given Transaction Table Entry.
Used by the final phase of the recovery to create new real transactions
to take on the identity of in-doubt prepared transactions found during
redo. Need to assume the globalId.
Parameters: ent - The original entry we are assuming the identity of. |
assumeIdentity | protected void assumeIdentity(TransactionTableEntry ent)(Code) | | Transform this identity to the one stored in transaction table entry.
Used by recovery only!
|
checkpointInRollForwardRecovery | public void checkpointInRollForwardRecovery(LogInstant cinstant, long redoLWM) throws StandardException(Code) | | perform a checkpoint during rollforward recovery
|
createXATransactionFromLocalTransaction | public void createXATransactionFromLocalTransaction(int format_id, byte[] global_id, byte[] branch_id) throws StandardException(Code) | | Convert a local transaction to a global transaction.
Must only be called a previous local transaction was created and exists
in the context. Can only be called if the current transaction is in
the idle state, and no current global id.
Simply call setTransactionId() which takes care of error checking.
Parameters: format_id - the format id part of the Xid - ie. Xid.getFormatId(). Parameters: global_id - the global transaction identifier part of XID - ie.Xid.getGlobalTransactionId(). Parameters: branch_id - The branch qualifier of the Xid - ie. Xid.getBranchQaulifier() exception: StandardException - Standard exception policy. |
destroy | public void destroy() throws StandardException(Code) | | If this transaction is not idle, abort it. After this call close().
exception: StandardException - Standard Cloudscape error policyThrown if the transaction is not idle. |
doPostCommitWorkInTran | protected boolean doPostCommitWorkInTran()(Code) | | If this is a user transaction (not an internal or nested top
transaction), and this is not already taking care of post
commit work, and not an XA transaction, then take care of hi prioirty
work right now using this thread and this context manager.
Otherwise, leave it to the post commit daemon.
|
getActiveStateTxIdString | public String getActiveStateTxIdString()(Code) | | |
getCacheStats | public long[] getCacheStats(String cacheName)(Code) | | Get cache statistics for the specified cache
|
getCompatibilitySpace | public Object getCompatibilitySpace()(Code) | | Get the compatibility space of the transaction.
Returns an object that can be used with the lock manager to provide
the compatibility space of a transaction. 2 transactions with the
same compatibility space will not conflict in locks. The usual case
is that each transaction has it's own unique compatibility space.
The compatibility space of the transaction. |
getContextId | final public String getContextId()(Code) | | Get my transaction context Id
|
getDefaultLockingPolicy | public LockingPolicy getDefaultLockingPolicy()(Code) | | Get the current default locking policy for all operations within this
transaction. The transaction is initially started with a default
locking policy equivalent to
newLockingPolicy(
LockingPolicy.MODE_RECORD, TransactionController.ISOLATION_SERIALIZABLE, true);
This default can be changed by subsequent calls to
setDefaultLockingPolicy(LockingPolicy policy).
See Also: Transaction.getDefaultLockingPolicy The current default locking policy in this transaction. |
getFirstLogInstant | public LogInstant getFirstLogInstant()(Code) | | Get the log instant for the first log record written by this transaction.
|
getGlobalId | final public GlobalTransactionId getGlobalId()(Code) | | get the Global (external to raw store) transaction id that is unique
across all raw stores
|
getId | final public TransactionId getId()(Code) | | get the short (internal to raw store) transaction id that is unique
only for this raw store
|
getIdNoCheck | final protected TransactionId getIdNoCheck()(Code) | | Get the transaction id without sanity check, this should only be called
by a cloned TransactionTableEntry
|
getLastLogInstant | public LogInstant getLastLogInstant()(Code) | | Get the log instant for the last log record written by this transaction.
|
handlesPostTerminationWork | public boolean handlesPostTerminationWork()(Code) | | |
inAbort | public boolean inAbort()(Code) | | |
inRollForwardRecovery | public boolean inRollForwardRecovery()(Code) | | Is the transaction in rollforward recovery
|
isActive | final public boolean isActive()(Code) | | see if this transaction has ever done anything.
MT - single thread through synchronizing this. This method may be
called by other thread to test the state of this transaction. That's
why we need to synchronize with all methods which enters or exits the
Idle state.
Local method which read the state need not be synchronized because
the other thread may look at the state but it may not change it.
true if this transaction is not in idle or closed state |
isBlockingBackup | public boolean isBlockingBackup()(Code) | | Check if the transaction is blocking the backup ?
true if this transaction is blocking the backup, otherwise false |
isIdle | public boolean isIdle()(Code) | | See if this transaction is in the idle state, called by other thread to
test the state of this transaction. That's why we need to synchronzied
with all methods whcih enters or exits the idle state
true if it is idle, otherwise false |
isPrepared | final public boolean isPrepared()(Code) | | see if this transaction is in PREPARED state.
MT - single thread through synchronizing this. This method may be
called by other thread to test the state of this transaction.
true if this transaction is in PREPARED state. |
isPristine | public boolean isPristine()(Code) | | see if this transaction is in a pristine state.
MT - called only by the same thread that owns the xact, no need to synchronize.
true if it hasn't done any updates, otherwise false |
logAndDo | public void logAndDo(Loggable operation) throws StandardException(Code) | | Log the operation and do it.
If this transaction has not generated any log records prior to this,
then log a beginXact log record.
If the passed in operation is null, then do nothing (after logging the
beginXact if needed).
exception: StandardException - Standard cloudscape exception policy See Also: Transaction.logAndDo See Also: |
popSavePoints | protected boolean popSavePoints(int position, boolean release) throws StandardException(Code) | | Pop all savepoints upto the one with the given name and rollback
all changes made since this savepoint was pushed.
If release is true then this savepoint is popped as well,
otherwise it is left in the stack (at the top).
true if any work is rolled back, false if no work is rolled back exception: StandardException - Standard cloudscape policy exception: StandardException - Thrown if a error of severity less than TransactionException#SEVERITYis encountered during the rollback of this savepoint. |
prepareTransaction | public void prepareTransaction()(Code) | | Remove this from the xactFactory list of update transaction.
|
reCreateContainerForRedoRecovery | public void reCreateContainerForRedoRecovery(long segmentId, long containerId, ByteArray containerInfo) throws StandardException(Code) | | Recreate a container during redo recovery.
Used only during redo recovery while processing log records which
are trying to create a container, and no valid container is found
in the database.
exception: StandardException - Standard cloudscape exception policy See Also: RawTransaction.reCreateContainerForRedoRecovery |
recoveryTransaction | public void recoveryTransaction()(Code) | | |
removeUpdateTransaction | public void removeUpdateTransaction()(Code) | | Remove this from the xactFactory list of update transaction.
|
reprepare | public void reprepare() throws StandardException(Code) | | During recovery re-prepare a transaction.
After redo() and undo(), this routine is called on all outstanding
in-doubt (prepared) transactions. This routine re-acquires all
logical write locks for operations in the xact, and then modifies
the transaction table entry to make the transaction look as if it
had just been prepared following startup after recovery.
This routine is only called during Recovery.
exception: StandardException - Standard exception policy. |
resetCacheStats | public void resetCacheStats(String cacheName)(Code) | | Reset the cache statistics for the specified cache
|
resetDefaultLocking | void resetDefaultLocking()(Code) | | |
setFirstLogInstant | public void setFirstLogInstant(LogInstant instant)(Code) | | Set the log instant for the first log record written by this transaction.
|
setIdleState | protected void setIdleState()(Code) | | |
setLastLogInstant | public void setLastLogInstant(LogInstant instant)(Code) | | Set the log instant for the last log record written by this transaction.
|
setPostComplete | void setPostComplete()(Code) | | Set the transaction to issue pre complete work at postComplete
time, instead of preComplete time. This means that latches
and containers will be held open until after a commit or an abort.
|
setPrepareState | final protected void setPrepareState() throws StandardException(Code) | | Move the state of the transaction from UPDATE to PREPARE.
The state transition should only be from UPDATE to PREPARE. Read-only
transactions (IDLE and ACTIVE) will never be prepared, they will be
commited when the prepare is requested. Only Update transactions will
be allowed to go to prepared state.
exception: StandardException - Standard exception policy. |
statusForBeginXactLog | protected int statusForBeginXactLog()(Code) | | put this into the beginXact log record to help recovery
if we needs to rolled back first, put that in
|
statusForEndXactLog | protected int statusForEndXactLog()(Code) | | put this into the endXact log record to help recovery,
nothing to add
|
toString | public String toString()(Code) | | Return the xid as a string.
The virtual lock table depends on this routine returning just the
local transaction id as a string, even if it is a global transaction.
Joins between the lock table and the transaction table will not work
if this routine returns anything other than myId.toString().
The xid as a string. |
xa_commit | public void xa_commit(boolean onePhase) throws StandardException(Code) | | This method is called to commit the current XA global transaction.
RESOLVE - how do we map to the "right" XAExceptions.
Parameters: onePhase - If true, the resource manager should use a one-phasecommit protocol to commit the work done on behalf of current xid. exception: StandardException - Standard exception policy. |
xa_prepare | public int xa_prepare() throws StandardException(Code) | | This method is called to ask the resource manager to prepare for
a transaction commit of the transaction specified in xid.
A value indicating the resource manager's vote on thethe outcome of the transaction. The possible valuesare: XA_RDONLY or XA_OK. If the resource manager wantsto roll back the transaction, it should do so by throwing an appropriate XAException in the preparemethod. exception: StandardException - Standard exception policy. |
xa_rollback | public void xa_rollback() throws StandardException(Code) | | rollback the current global transaction.
The given transaction is roll'ed back and it's history is not
maintained in the transaction table or long term log.
exception: StandardException - Standard exception policy. |
|
|