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
ConstructorsConstructorDescriptionIn-memory, non persistent, transactional integerTransInteger(long v) In-memory, non persistent, transactional integerTransInteger(long v, ComponentId componentId) In-memory, non persistent, transactional integerTransInteger(String filename, ComponentId cid) Persistent, transactional integer. -
Method Summary
Modifier and TypeMethodDescriptionvoidIndicate that no recovery is being done (the journal thinks everything was completed last time)voidEnd of the recovery phaselongget()Return the current value.voidinc()Set the value, return the old valuelongread()Return the current value in a transaction. svoidrecover(ByteBuffer ref) Notification thatrefwas really committed and is being recovered.longset(long x) Set the value, return the old valuevoidtoString()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 Details
-
TransInteger
public TransInteger()In-memory, non persistent, transactional integer -
TransInteger
public TransInteger(long v) In-memory, non persistent, transactional integer -
TransInteger
In-memory, non persistent, transactional integer -
TransInteger
Persistent, transactional integer. The persistent state is held in filename. When first initialized, the value is 0L.- Parameters:
filename- Persistent statecid- Component id
-
-
Method Details
-
startRecovery
public void startRecovery()- Specified by:
startRecoveryin interfaceTransactionalComponent- Specified by:
startRecoveryin classTransactionalComponentLifecycle<org.apache.jena.dboe.transaction.TransInteger.IntegerState>
-
recover
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
-