Class TransactionalComponentWrapper
- java.lang.Object
-
- org.apache.jena.dboe.transaction.txn.TransactionalComponentWrapper
-
- All Implemented Interfaces:
TransactionalComponent
public class TransactionalComponentWrapper extends java.lang.Object implements TransactionalComponent
-
-
Constructor Summary
Constructors Constructor Description TransactionalComponentWrapper(TransactionalComponent other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Transaction transaction)Abort a transaction (undo the effect of a transaction)voidattach(SysTransState systemState)Set the current thread to be in the transaction.voidbegin(Transaction transaction)Start a transaction; return an identifier for this components use.voidcleanStart()Indicate that no recovery is being done (the journal thinks everything was completed last time)voidcommit(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)Prepare for a commit.voidcomplete(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)voidfinishRecovery()End of the recovery phaseComponentIdgetComponentId()Every component instance must supplied a unique number.booleanpromote(Transaction transaction)Promote a component in a transaction.voidrecover(java.nio.ByteBuffer ref)Notification thatrefwas really committed and is being recovered.voidshutdown()Shutdown component, aborting any in-progress transactions.voidstartRecovery()java.lang.StringtoString()
-
-
-
Constructor Detail
-
TransactionalComponentWrapper
public TransactionalComponentWrapper(TransactionalComponent other)
-
-
Method Detail
-
startRecovery
public void startRecovery()
- Specified by:
startRecoveryin interfaceTransactionalComponent
-
recover
public 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 void finishRecovery()
Description copied from interface:TransactionalComponentEnd of the recovery phase- Specified by:
finishRecoveryin interfaceTransactionalComponent
-
cleanStart
public void cleanStart()
Description copied from interface:TransactionalComponentIndicate that no recovery is being done (the journal thinks everything was completed last time)- Specified by:
cleanStartin 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 void begin(Transaction transaction)
Description copied from interface:TransactionalComponentStart a transaction; return an identifier for this components use.- Specified by:
beginin interfaceTransactionalComponent
-
promote
public boolean promote(Transaction transaction)
Description copied from interface:TransactionalComponentPromote a component in a transaction.May return "false" for "can't do that" if the transaction can not be promoted.
May throw
UnsupportedOperationExceptionif promotion is not supported.- Specified by:
promotein interfaceTransactionalComponent
-
commitPrepare
public java.nio.ByteBuffer commitPrepare(Transaction transaction)
Description copied from interface:TransactionalComponentPrepare for a commit. Returns some bytes that will be written to the journal. The journal remains valid untilTransactionalComponent.commitEnd(org.apache.jena.dboe.transaction.txn.Transaction)is called.- Specified by:
commitPreparein interfaceTransactionalComponent
-
commit
public 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 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 void abort(Transaction transaction)
Description copied from interface:TransactionalComponentAbort a transaction (undo the effect of a transaction)- Specified by:
abortin interfaceTransactionalComponent
-
complete
public void complete(Transaction transaction)
Description copied from interface:TransactionalComponentFinalization - the coordinator will not mention the transaction again.- Specified by:
completein interfaceTransactionalComponent
-
detach
public 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 systemState)
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
-
shutdown
public 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-