Class TransactionManager

java.lang.Object
org.apache.jena.tdb1.transaction.TransactionManager

public class TransactionManager extends Object
  • Field Details

    • QueueBatchSize

      public static int QueueBatchSize
      This controls how many write transactions we batch up before deciding to try to flush the journal to the main database.
    • JournalThresholdSize

      public static int JournalThresholdSize
      This controls how large to let the journal get in size before deciding to flush even if below the queue batch size. -1 means "off".
    • MaxQueueThreshold

      public static int MaxQueueThreshold
      This controls how large to let the journal in comitted transactions before deciding to pause and flush as soon as possible. -1 means "off".
    • DEBUG

      public static final boolean DEBUG
      See Also:
  • Constructor Details

  • Method Details

    • activeTransactions

      public boolean activeTransactions()
    • getCountActiveReaders

      public long getCountActiveReaders()
    • getCountActiveWriters

      public long getCountActiveWriters()
    • getQueueLength

      public long getQueueLength()
    • closedown

      public void closedown()
    • addAdditionComponent

      public void addAdditionComponent(TransactionLifecycle txnLifecycle)
      Add a TransactionLifecycle to transactions createed from this point onwards.
    • begin

      public DatasetGraphTxn begin(org.apache.jena.query.TxnType txnType, String label)
    • blockWriters

      public void blockWriters()
      Block until no writers are active. When this returns, it guarantees that the database is not changing and the journal is flush to disk.

      The application must call enableWriters() later.

      This operation must not be nested (it will block).

      See Also:
    • tryBlockWriters

      public boolean tryBlockWriters()
      Block until no writers are active or, optionally, return if can't at the moment. Return 'true' if the operation succeeded.

      If it returns true, the application must call enableWriters() later.

      See Also:
    • enableWriters

      public void enableWriters()
      Allow writers. This must be used in conjunction with blockWriters() or tryBlockWriters()
      See Also:
    • startExclusiveMode

      public void startExclusiveMode()
      Enter exclusive mode.

      There are no active transactions on return; new transactions will be held up in 'begin'. Return to normal (release waiting transactions, allow new transactions) with finishExclusiveMode().

      The caller must not be inside a transaction associated with this TransactionManager. (The call will block waiting for that transaction to finish.)

    • tryExclusiveMode

      public boolean tryExclusiveMode()
      Try to enter exclusive mode. If return is true, then are no active transactions on return and new transactions will be held up in 'begin'. If false, there is an in-progress transactions. Return to normal (release waiting transactions, allow new transactions) with finishExclusiveMode().

      The call must not itself be in a transaction (this call will return false).

    • getExclusivityLock$

      public ReadWriteLock getExclusivityLock$()
      Return the exclusivity lock. Testing and internal use only.
    • finishExclusiveMode

      public void finishExclusiveMode()
      Return to normal (release waiting transactions, allow new transactions). Must be paired with an earlier startExclusiveMode().
    • flush

      public void flush()
      Try to flush the delayed write queue - only happens if there are no active transactions
    • recording

      public boolean recording()
      Get recording state
    • recording

      public void recording(boolean flag)
      Set recording on or off
    • clearRecordingState

      public void clearRecordingState()
      Clear all recording state - does not clear stats
    • getJournal

      public Journal getJournal()
    • state

      public SysTxnState state()