- All Implemented Interfaces:
TransactionalComponent
TransactionalComponent lifecycle,
it logs the event.-
Constructor Summary
ConstructorsConstructorDescriptionCreate a logger for begin-commit/abort-endTransLogger(org.slf4j.Logger logger) Create a logger, either just begin-commit/abort-end or all stepsTransLogger(org.slf4j.Logger logger, boolean all) Create a logger, either just begin-commit/abort-end or all steps -
Method Summary
Modifier and TypeMethodDescriptionvoidabort(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.voidIndicate 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.commitPrepare(Transaction transaction) Prepare for a commit.voidcomplete(Transaction transaction) Finalization - the coordinator will not mention the transaction again.detach()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)voidEnd of the recovery phaseEvery component instance must supplied a unique number.booleanpromote(Transaction transaction) Promote a component in a transaction.voidrecover(ByteBuffer ref) Notification thatrefwas really committed and is being recovered.voidshutdown()Shutdown component, aborting any in-progress transactions.void
-
Constructor Details
-
TransLogger
public TransLogger()Create a logger for begin-commit/abort-end -
TransLogger
public TransLogger(org.slf4j.Logger logger) Create a logger, either just begin-commit/abort-end or all steps -
TransLogger
public TransLogger(org.slf4j.Logger logger, boolean all) Create a logger, either just begin-commit/abort-end or all steps
-
-
Method Details
-
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
-
startRecovery
public void startRecovery()- Specified by:
startRecoveryin interfaceTransactionalComponent
-
recover
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
-
begin
Description copied from interface:TransactionalComponentStart a transaction; return an identifier for this components use.- Specified by:
beginin interfaceTransactionalComponent
-
promote
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
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
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
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
Description copied from interface:TransactionalComponentAbort a transaction (undo the effect of a transaction)- Specified by:
abortin interfaceTransactionalComponent
-
complete
Description copied from interface:TransactionalComponentFinalization - the coordinator will not mention the transaction again.- Specified by:
completein interfaceTransactionalComponent
-
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
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
-