Package org.apache.jena.dboe.transaction
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).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle
TransactionalComponentLifecycle.ComponentState<X>
-
-
Constructor Summary
Constructors Constructor Description TransInteger()In-memory, non persistent, transactional integerTransInteger(long v)In-memory, non persistent, transactional integerTransInteger(long v, ComponentId componentId)In-memory, non persistent, transactional integerTransInteger(java.lang.String filename, ComponentId cid)Persistent, transactional integer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanStart()Indicate that no recovery is being done (the journal thinks everything was completed last time)voidfinishRecovery()End of the recovery phaselongget()Return the current value.voidinc()Set the value, return the old valuelongread()Return the current value in a transaction.voidrecover(java.nio.ByteBuffer ref)Notification thatrefwas really committed and is being recovered.longset(long x)Set the value, return the old valuevoidstartRecovery()java.lang.StringtoString()longvalue()Read the current global state (that is, the last committed value) outside a transaction.-
Methods inherited from class org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle
abort, attach, begin, commit, commitEnd, commitPrepare, complete, detach, getComponentId, getComponentState, promote, setComponentState, shutdown
-
-
-
-
Constructor Detail
-
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(java.lang.String filename, ComponentId cid)Persistent, transactional integer. The persistent state is held in filename. When first initialized, the value is 0L.- Parameters:
filename- Persistent statecid- Component id
-
-
Method Detail
-
startRecovery
public void startRecovery()
- Specified by:
startRecoveryin interfaceTransactionalComponent- Specified by:
startRecoveryin classTransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
-
recover
public void recover(java.nio.ByteBuffer ref)
Description copied from interface:TransactionalComponentNotification thatrefwas really committed and is being recovered.- Specified by:
recoverin interfaceTransactionalComponent- Specified by:
recoverin classTransactionalComponentLifecycle<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:TransactionalComponentEnd of the recovery phase- Specified by:
finishRecoveryin interfaceTransactionalComponent- Specified by:
finishRecoveryin classTransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
-
cleanStart
public void cleanStart()
Description copied from interface:TransactionalComponentIndicate 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 theTransIntegerstate is atomic).
-
value
public long value()
Read the current global state (that is, the last committed value) outside a transaction.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-