org.apache.directory.mavibot.btree

## Class ReadTransaction<K,V>

- java.lang.Object
- - org.apache.directory.mavibot.btree.ReadTransaction<K,V>

- Type Parameters:
    `K` - The type for the Key
    `V` - The type for the stored value

      public class ReadTransaction<K,V>
      extends Object

  The Transaction is used to protect the BTree against concurrent modification, and insure that a read is always done against one single revision. It's also used to gather many modifications under one single revision, if needed.

  A Transaction should be closed when the user is done with it, otherwise the pages associated with the given revision, and all the referenced pages, will remain on the storage.

  A Transaction can be hold for quite a long time, for instance while doing a browse against a big BTree. At some point, transactions which are pending for too long will be closed by the transaction manager.
  Author:
    Apache Directory Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReadTransaction(org.apache.directory.mavibot.btree.BTreeHeader<K,V> btreeHeader, ConcurrentLinkedQueue<ReadTransaction<K,V>> readTransactions)` Creates a new transaction instance
    `ReadTransaction(RecordManager recordManager, org.apache.directory.mavibot.btree.BTreeHeader<K,V> btreeHeader, ConcurrentLinkedQueue<ReadTransaction<K,V>> readTransactions)` Creates a new transaction instance

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the transaction, releasing the revision it was using.
    `org.apache.directory.mavibot.btree.BTreeHeader<K,V>` | `getBtreeHeader()`
    `long` | `getCreationDate()`
    `long` | `getRevision()`
    `boolean` | `isClosed()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ReadTransaction

          public ReadTransaction(RecordManager recordManager,
                         org.apache.directory.mavibot.btree.BTreeHeader<K,V> btreeHeader,
                         ConcurrentLinkedQueue<ReadTransaction<K,V>> readTransactions)

      Creates a new transaction instance
      Parameters:
        `btreeHeader` - The BtreeHeader we will use for this read transaction

    - #### ReadTransaction

          public ReadTransaction(org.apache.directory.mavibot.btree.BTreeHeader<K,V> btreeHeader,
                         ConcurrentLinkedQueue<ReadTransaction<K,V>> readTransactions)

      Creates a new transaction instance
      Parameters:
        `btreeHeader` - The BtreeHeader we will use for this read transaction

  - ### Method Detail

    - #### getRevision

          public long getRevision()

      Returns:
        the associated revision

    - #### getCreationDate

          public long getCreationDate()

      Returns:
        the creationDate

    - #### getBtreeHeader

          public org.apache.directory.mavibot.btree.BTreeHeader<K,V> getBtreeHeader()

      Returns:
        the btreeHeader

    - #### close

          public void close()

      Close the transaction, releasing the revision it was using.

    - #### isClosed

          public boolean isClosed()

      Returns:
        true if this transaction has been closed

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      See Also:
        `Object.toString()`

Copyright © 2012–2015 Apache Mavibot Project Parent. All rights reserved.