Class XACommittingTx

java.lang.Object
org.objectweb.howl.log.xa.XACommittingTx

public class XACommittingTx extends 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
    Flag indicating that the TM has called XALogger.putDone().
    private final int
    workerID into the activeTx[] that this entry will be stored.
    private byte[]
    byte[] representation of this.index.
    private long
    the log key associated with the COMMIT record for this transaction
    private ByteBuffer
    Used to putLong(logKey) into logKeyBytes.
    private byte[]
    byte[] representation of logKey.
    (package private) byte[][]
    data record for XADONE record generated by XALogger#putDone().
    private boolean
    Flag indicating that the log overflow notification routine is in the process of moving this record.
    private byte[][]
    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

    Modifier and Type
    Method
    Description
    (package private) final int
    returns an workerID into an array of XACommittingTx objects that holds a reference to this XACommittingTx.
    final long
     
    final byte[][]
    returns the byte[][] containing the COMMIT record data.
    final boolean
    returns done as maintained by XALogger.putCommit() and XALogger.putDone().
    final boolean
     
    (package private) final void
    setDone(boolean done)
     
    (package private) final void
    setLogKey(long logKey)
    sets the log key associated with the COMMIT record for this transaction.
    (package private) final void
    setMoving(boolean moving)
    used by logOverflowNotification to mark XACommittingTx entries in the process of being moved.
    (package private) final void
    setRecord(byte[][] record)
    saves a reference to the byte[][] containing the COMMIT record data.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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 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().
  • Constructor Details

    • XACommittingTx

      XACommittingTx(int index)
      constructs a new XACommittingTx instance.
  • Method Details

    • 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.