Class TransactionalComponentLifecycle<X>
- java.lang.Object
-
- org.apache.jena.dboe.transaction.txn.TransactionalComponentLifecycle<X>
-
- All Implemented Interfaces:
TransactionalComponent
- Direct Known Subclasses:
TransactionalComponentBase,TransactionalComponentByLock,TransInteger
public abstract class TransactionalComponentLifecycle<X> extends java.lang.Object implements TransactionalComponent
Base implementation of the component interface forTransactionalComponent.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTransactionalComponentLifecycle.ComponentState<X>
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidabort(Transaction transaction)Abort a transaction (undo the effect of a transaction)voidattach(SysTransState state)Set the current thread to be in the transaction.voidbegin(Transaction transaction)Start a transactionvoidcommit(Transaction transaction)Commit a transaction (make durable).voidcommitEnd(Transaction transaction)Signal all commits on all components are done and replay from the journal will not happen.java.nio.ByteBuffercommitPrepare(Transaction transaction)Commit a transaction (make durable): prepare - commit - cleanupvoidcomplete(Transaction transaction)Finalization - the coordinator will not mention the transaction again.SysTransStatedetach()Detach this component from the transaction of the current thread and return some internal state that can be used in a future call ofTransactionalComponent.attach(SysTransState)abstract voidfinishRecovery()End of the recovery phaseComponentIdgetComponentId()Every component instance must supplied a unique number.TransactionalComponentLifecycle.ComponentState<X>getComponentState()booleanpromote(Transaction transaction)Promote a component in a transactionabstract voidrecover(java.nio.ByteBuffer ref)Notification thatrefwas really committed and is being recovered.voidsetComponentState(TransactionalComponentLifecycle.ComponentState<X> state)voidshutdown()Shutdown component, aborting any in-progress transactions.abstract voidstartRecovery()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jena.dboe.transaction.txn.TransactionalComponent
cleanStart
-
-
-
-
Method Detail
-
startRecovery
public abstract void startRecovery()
- Specified by:
startRecoveryin interfaceTransactionalComponent
-
recover
public abstract void recover(java.nio.ByteBuffer ref)
Description copied from interface:TransactionalComponentNotification thatrefwas really committed and is being recovered.- Specified by:
recoverin interfaceTransactionalComponent- Parameters:
ref- Same bytes as were written during prepare originally.
-
finishRecovery
public abstract void finishRecovery()
Description copied from interface:TransactionalComponentEnd of the recovery phase- Specified by:
finishRecoveryin interfaceTransactionalComponent
-
getComponentId
public ComponentId getComponentId()
Description copied from interface:TransactionalComponentEvery component instance must supplied a unique number. It is used to route journal entries to subsystems, including across restarts/recovery. Uniqueness scope is within the sameTransactionCoordinator, and the same across restarts.If a component imposes the rule of one-per-
TransactionCoordinator, the same number can be used (if different from all other component type instances).If a component can have multiple instances per
TransactionCoordinator, for example indexes, each must have a unique instance id.- Specified by:
getComponentIdin interfaceTransactionalComponent
-
begin
public final void begin(Transaction transaction)
Start a transaction- Specified by:
beginin interfaceTransactionalComponent
-
promote
public final boolean promote(Transaction transaction)
Promote a component in a transaction- Specified by:
promotein interfaceTransactionalComponent
-
commitPrepare
public final java.nio.ByteBuffer commitPrepare(Transaction transaction)
Commit a transaction (make durable): prepare - commit - cleanup- Specified by:
commitPreparein interfaceTransactionalComponent
-
commit
public final void commit(Transaction transaction)
Description copied from interface:TransactionalComponentCommit a transaction (make durable). The transaction will commit and not abort. Other components may not have committed yet and recovery may occur still causing replay of the commit step.- Specified by:
commitin interfaceTransactionalComponent
-
commitEnd
public final void commitEnd(Transaction transaction)
Description copied from interface:TransactionalComponentSignal all commits on all components are done and replay from the journal will not happen. The component can clear up now.- Specified by:
commitEndin interfaceTransactionalComponent
-
abort
public final void abort(Transaction transaction)
Description copied from interface:TransactionalComponentAbort a transaction (undo the effect of a transaction)- Specified by:
abortin interfaceTransactionalComponent
-
complete
public final void complete(Transaction transaction)
Description copied from interface:TransactionalComponentFinalization - the coordinator will not mention the transaction again.- Specified by:
completein interfaceTransactionalComponent
-
shutdown
public final void shutdown()
Description copied from interface:TransactionalComponentShutdown component, aborting any in-progress transactions. This operation is not guaranteed to be called.- Specified by:
shutdownin interfaceTransactionalComponent
-
detach
public final SysTransState detach()
Description copied from interface:TransactionalComponentDetach this component from the transaction of the current thread and return some internal state that can be used in a future call ofTransactionalComponent.attach(SysTransState)After this call, the component is not in a transaction but the existing transaction still exists. The thread may start a new transaction; that transaction is completely independent of the detached transaction.
Returns
nullif the current thread not in a transaction. The component may return null to indicate it has no state. The return system state should be used in a call toTransactionalComponent.attach(SysTransState)and the transaction ended in the usual way.- Specified by:
detachin interfaceTransactionalComponent
-
attach
public void attach(SysTransState state)
Description copied from interface:TransactionalComponentSet the current thread to be in the transaction. ThesystemStatemust be obtained from a call ofTransactionalComponent.detach(). This method can only be called once persystemState.- Specified by:
attachin interfaceTransactionalComponent
-
getComponentState
public TransactionalComponentLifecycle.ComponentState<X> getComponentState()
-
setComponentState
public void setComponentState(TransactionalComponentLifecycle.ComponentState<X> state)
-
-