Class TransInteger

java.lang.Object
org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
org.apache.jena.dboe.transaction.TransInteger
All Implemented Interfaces:
TransactionalComponent

public class TransInteger extends TransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
A transaction component with an integer supporting MR+SW (=one writer AND many readers).
  • Constructor Details

    • TransInteger

      public TransInteger()
      In-memory, non persistent, transactional integer
    • TransInteger

      public TransInteger(long v)
      In-memory, non persistent, transactional integer
    • TransInteger

      public TransInteger(long v, ComponentId componentId)
      In-memory, non persistent, transactional integer
    • TransInteger

      public TransInteger(String filename, ComponentId cid)
      Persistent, transactional integer. The persistent state is held in filename. When first initialized, the value is 0L.
      Parameters:
      filename - Persistent state
      cid - Component id
  • Method Details

    • startRecovery

      public void startRecovery()
      Specified by:
      startRecovery in interface TransactionalComponent
      Specified by:
      startRecovery in class TransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
    • recover

      public void recover(ByteBuffer ref)
      Description copied from interface: TransactionalComponent
      Notification that ref was really committed and is being recovered.
      Specified by:
      recover in interface TransactionalComponent
      Specified by:
      recover in class TransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
      Parameters:
      ref - Same bytes as were written during prepare originally.
    • finishRecovery

      public void finishRecovery()
      Description copied from interface: TransactionalComponent
      End of the recovery phase
      Specified by:
      finishRecovery in interface TransactionalComponent
      Specified by:
      finishRecovery in class TransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
    • cleanStart

      public void cleanStart()
      Description copied from interface: TransactionalComponent
      Indicate that no recovery is being done (the journal thinks everything was completed last time)
    • inc

      public void inc()
      Set the value, return the old value
    • set

      public long set(long x)
      Set the value, return the old value
    • read

      public long read()
      Return the current value in a transaction. s
    • get

      public long get()
      Return the current value. If inside a transaction, return the transaction view of the value. If not in a transaction return the state value (effectively a read transaction, optimized by the fact that reading the TransInteger state is atomic).
    • value

      public long value()
      Read the current global state (that is, the last committed value) outside a transaction.
    • toString

      public String toString()
      Overrides:
      toString in class Object