Class DatasetGraphTxnCtl

java.lang.Object
org.apache.jena.sparql.core.DatasetGraphWrapper
org.apache.jena.dboe.storage.system.DatasetGraphTxnCtl
All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable, org.apache.jena.atlas.lib.Sync, org.apache.jena.dboe.transaction.txn.TransactionalSystemControl, org.apache.jena.sparql.core.DatasetGraph, org.apache.jena.sparql.core.Transactional

public class DatasetGraphTxnCtl extends org.apache.jena.sparql.core.DatasetGraphWrapper implements org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
A DatasetGraph wrapper that controls entry and exit of transactions. It provides two controls:
  • Exclusive access - no transactions active (used by TDB2 compact)
  • Read-only database - No possible writers (that is, transaction types write and the promote forms transactions)
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.jena.sparql.core.Transactional

    org.apache.jena.sparql.core.Transactional.Promote
  • Constructor Summary

    Constructors
    Constructor
    Description
    DatasetGraphTxnCtl(org.apache.jena.sparql.core.DatasetGraph dsg)
     
    DatasetGraphTxnCtl(org.apache.jena.sparql.core.DatasetGraph dsg, org.apache.jena.sparql.util.Context context)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    begin(org.apache.jena.query.ReadWrite readWrite)
     
    void
    begin(org.apache.jena.query.TxnType txnType)
     
    void
     
    void
    end()
     
    void
    Return to normal (release waiting transactions, allow new transactions).
    void
     
    void
    Release any waiting potential writers.
    void
    Enter exclusive mode; block if necessary.
    void
     
    void
    Block until no writers or promote transactions present are present.
    boolean
    Try to enter exclusive mode.
    boolean
    tryExclusiveMode(boolean canBlock)
    Try to enter exclusive mode.
    boolean
    tryNonExclusiveMode(boolean canBlock)
     

    Methods inherited from class org.apache.jena.sparql.core.DatasetGraphWrapper

    add, add, addGraph, begin, clear, close, contains, contains, containsGraph, delete, delete, deleteAny, find, find, find, findNG, getBase, getBaseForQuery, getContext, getDefaultGraph, getGraph, getLock, getUnionGraph, getWrapped, isEmpty, isInTransaction, listGraphNodes, prefixes, promote, promote, removeGraph, size, supportsTransactionAbort, supportsTransactions, sync, toString, transactionMode, transactionType, unwrap

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.jena.sparql.core.DatasetGraph

    addAll, stream, stream

    Methods inherited from interface org.apache.jena.sparql.core.Transactional

    calc, calculate, calculateRead, calculateWrite, exec, execute, executeRead, executeWrite

    Methods inherited from interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl

    execExclusive, execReadOnlyDatabase, tryNonExclusiveMode
  • Constructor Details

    • DatasetGraphTxnCtl

      public DatasetGraphTxnCtl(org.apache.jena.sparql.core.DatasetGraph dsg)
    • DatasetGraphTxnCtl

      public DatasetGraphTxnCtl(org.apache.jena.sparql.core.DatasetGraph dsg, org.apache.jena.sparql.util.Context context)
  • Method Details

    • begin

      public void begin(org.apache.jena.query.TxnType txnType)
      Specified by:
      begin in interface org.apache.jena.sparql.core.Transactional
      Overrides:
      begin in class org.apache.jena.sparql.core.DatasetGraphWrapper
    • begin

      public void begin(org.apache.jena.query.ReadWrite readWrite)
      Specified by:
      begin in interface org.apache.jena.sparql.core.Transactional
      Overrides:
      begin in class org.apache.jena.sparql.core.DatasetGraphWrapper
    • commit

      public void commit()
      Specified by:
      commit in interface org.apache.jena.sparql.core.Transactional
      Overrides:
      commit in class org.apache.jena.sparql.core.DatasetGraphWrapper
    • abort

      public void abort()
      Specified by:
      abort in interface org.apache.jena.sparql.core.Transactional
      Overrides:
      abort in class org.apache.jena.sparql.core.DatasetGraphWrapper
    • end

      public void end()
      Specified by:
      end in interface org.apache.jena.sparql.core.Transactional
      Overrides:
      end in class org.apache.jena.sparql.core.DatasetGraphWrapper
    • startReadOnlyDatabase

      public void startReadOnlyDatabase()
      Block until no writers or promote transactions present are present.
      Specified by:
      startReadOnlyDatabase in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
    • finishReadOnlyDatabase

      public void finishReadOnlyDatabase()
      Release any waiting potential writers.
      Specified by:
      finishReadOnlyDatabase in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
    • startNonExclusiveMode

      public void startNonExclusiveMode()
      Specified by:
      startNonExclusiveMode in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
    • tryNonExclusiveMode

      public boolean tryNonExclusiveMode(boolean canBlock)
      Specified by:
      tryNonExclusiveMode in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
    • finishNonExclusiveMode

      public void finishNonExclusiveMode()
      Specified by:
      finishNonExclusiveMode in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
    • startExclusiveMode

      public void startExclusiveMode()
      Enter exclusive mode; block if necessary. 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().

      Do not call inside an existing transaction.

      Specified by:
      startExclusiveMode in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
    • tryExclusiveMode

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

      Do not call inside an existing transaction.

      Specified by:
      tryExclusiveMode in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
    • tryExclusiveMode

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

      Do not call inside an existing transaction.

      Specified by:
      tryExclusiveMode in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl
      Parameters:
      canBlock - Allow the operation block and wait for the exclusive mode lock.
    • finishExclusiveMode

      public void finishExclusiveMode()
      Return to normal (release waiting transactions, allow new transactions). Must be paired with an earlier startExclusiveMode().
      Specified by:
      finishExclusiveMode in interface org.apache.jena.dboe.transaction.txn.TransactionalSystemControl