Class XACommittingTx
- java.lang.Object
-
- org.objectweb.howl.log.xa.XACommittingTx
-
public class XACommittingTx extends java.lang.Object
XA Transaction Managers write log records using the XALogger subclass of the basic HOWL Logger. The XALogger methods keep track of transactions that are in the COMMITTING state using XACommittingTx objects.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
done
Flag indicating that the TM has called XALogger.putDone().private int
index
workerID into the activeTx[] that this entry will be stored.private byte[]
indexBytes
byte[] representation of this.index.private long
logKey
the log key associated with the COMMIT record for this transactionprivate java.nio.ByteBuffer
LogKeyBB
Used to putLong(logKey) into logKeyBytes.private byte[]
logKeyBytes
byte[] representation of logKey.(package private) byte[][]
logKeyData
data record for XADONE record generated by XALogger#putDone().private boolean
moving
Flag indicating that the log overflow notification routine is in the process of moving this record.private byte[][]
record
reference to the COMMIT data record the TM wrote to the log.
-
Constructor Summary
Constructors Constructor Description XACommittingTx(int index)
constructs a new XACommittingTx instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
getIndex()
returns an workerID into an array of XACommittingTx objects that holds a reference to this XACommittingTx.long
getLogKey()
byte[][]
getRecord()
returns the byte[][] containing the COMMIT record data.boolean
isDone()
returns done as maintained by XALogger.putCommit() and XALogger.putDone().boolean
isMoving()
(package private) void
setDone(boolean done)
(package private) void
setLogKey(long logKey)
sets the log key associated with the COMMIT record for this transaction.(package private) void
setMoving(boolean moving)
used by logOverflowNotification to mark XACommittingTx entries in the process of being moved.(package private) void
setRecord(byte[][] record)
saves a reference to the byte[][] containing the COMMIT record data.
-
-
-
Field Detail
-
record
private byte[][] record
reference to the COMMIT data record the TM wrote to the log.TM must not change this record until the DONE record has been logged. Specifically, once the TM calls XALogger.putCommit() it must not change the byte[][] that was logged.
-
index
private final int index
workerID into the activeTx[] that this entry will be stored.Each XACommittingTx instance is assigned a fixed slot in the activeTx[]. Entries in the activeTx[] are set to null when not in use.
When the XACommittingTx object is constructed, it is stored into the availableTx[] using workerID . The entry is removed
-
logKey
private long logKey
the log key associated with the COMMIT record for this transaction
-
done
private boolean done
Flag indicating that the TM has called XALogger.putDone().initialized to false in XALogger.putCommit() and set to true in XALogger.putDone().
Examined by logOverflowNotification processor to determine if the entry needs to be moved. Entries that are marked
-
moving
private boolean moving
Flag indicating that the log overflow notification routine is in the process of moving this record.To assure that the DONE record is always recorded after the COMMIT record, XALogger.putDone() must wait until moving is false before it writes the DONE record to the log.
-
logKeyBytes
private byte[] logKeyBytes
byte[] representation of logKey.Recorded to the log by XALogger#putDone as the record data of the XADONE record.
-
LogKeyBB
private java.nio.ByteBuffer LogKeyBB
Used to putLong(logKey) into logKeyBytes.
-
indexBytes
private byte[] indexBytes
byte[] representation of this.index.Recorded to the log by XALogger#putDone as a diagnostic aid.
-
logKeyData
byte[][] logKeyData
data record for XADONE record generated by XALogger#putDone().
-
-
Method Detail
-
getRecord
public final byte[][] getRecord()
returns the byte[][] containing the COMMIT record data.This method is used by the log overflow notification processor to retrieve the original record data and write a new copy of the COMMIT record.
- Returns:
- the byte[][] containing the COMMIT record data.
-
setRecord
final void setRecord(byte[][] record)
saves a reference to the byte[][] containing the COMMIT record data.- Parameters:
record
- the byte[][] that was passed to the putCommit() routine of XALogger.
-
getIndex
final int getIndex()
returns an workerID into an array of XACommittingTx objects that holds a reference to this XACommittingTx.- Returns:
- an integer used as an workerID into an array of XATransactions.
-
getLogKey
public final long getLogKey()
- Returns:
- the log key associated with the COMMIT record for this transaction.
-
setLogKey
final void setLogKey(long logKey)
sets the log key associated with the COMMIT record for this transaction.also updates LogKeyBytes with byte[] form of logKey for subsequent recording in XADONE record.
- Parameters:
logKey
- a log key returned by Logger.put()
-
setDone
final void setDone(boolean done)
- Parameters:
done
- false while transaction is in COMMITTING state. true when two-phase-commit completes.
-
isDone
public final boolean isDone()
returns done as maintained by XALogger.putCommit() and XALogger.putDone().- Returns:
- boolean indicating whether the two-phase-commit processing is complete.
-
setMoving
final void setMoving(boolean moving)
used by logOverflowNotification to mark XACommittingTx entries in the process of being moved.The XALogger.putDone() method waits until moving is false.
- Parameters:
moving
- boolean indicating that entry is being moved by logOverflowNotification routine.
-
isMoving
public final boolean isMoving()
- Returns:
- true if logOverflowNotification routine is
moving the record.
The XALogger.putDone() method waits until moving is false.
-
-