public abstract class TransactionalComponentLifecycle<X> extends Object implements TransactionalComponent
TransactionalComponent.| Modifier and Type | Class and Description |
|---|---|
static class |
TransactionalComponentLifecycle.ComponentState<X> |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Transaction transaction)
Abort a transaction (undo the effect of a transaction)
|
void |
attach(SysTransState state)
Set the current thread to be in the transaction.
|
void |
begin(Transaction transaction)
Start a transaction
|
void |
commit(Transaction transaction)
Commit a transaction (make durable).
|
void |
commitEnd(Transaction transaction)
Signal all commits on all components are done and replay from the journal will not happen.
|
ByteBuffer |
commitPrepare(Transaction transaction)
Commit a transaction (make durable): prepare - commit - cleanup
|
void |
complete(Transaction transaction)
Finalization - the coordinator will not mention the transaction again.
|
SysTransState |
detach()
Detach this component from the transaction of the current thread
and return some internal state that can be used in a future call of
TransactionalComponent.attach(SysTransState) |
abstract void |
finishRecovery()
End of the recovery phase
|
ComponentId |
getComponentId()
Every component instance must supplied a unique number.
|
TransactionalComponentLifecycle.ComponentState<X> |
getComponentState() |
boolean |
promote(Transaction transaction)
Promote a component in a transaction
|
abstract void |
recover(ByteBuffer ref)
Notification that
ref was really committed and is being recovered. |
void |
setComponentState(TransactionalComponentLifecycle.ComponentState<X> state) |
void |
shutdown()
Shutdown component, aborting any in-progress transactions.
|
abstract void |
startRecovery() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcleanStartpublic abstract void startRecovery()
startRecovery in interface TransactionalComponentpublic abstract void recover(ByteBuffer ref)
TransactionalComponentref was really committed and is being recovered.recover in interface TransactionalComponentref - Same bytes as were written during prepare originally.public abstract void finishRecovery()
TransactionalComponentfinishRecovery in interface TransactionalComponentpublic ComponentId getComponentId()
TransactionalComponentTransactionCoordinator,
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.
getComponentId in interface TransactionalComponentpublic final void begin(Transaction transaction)
begin in interface TransactionalComponentpublic final boolean promote(Transaction transaction)
promote in interface TransactionalComponentpublic final ByteBuffer commitPrepare(Transaction transaction)
commitPrepare in interface TransactionalComponentpublic final void commit(Transaction transaction)
TransactionalComponentcommit in interface TransactionalComponentpublic final void commitEnd(Transaction transaction)
TransactionalComponentcommitEnd in interface TransactionalComponentpublic final void abort(Transaction transaction)
TransactionalComponentabort in interface TransactionalComponentpublic final void complete(Transaction transaction)
TransactionalComponentcomplete in interface TransactionalComponentpublic final void shutdown()
TransactionalComponentshutdown in interface TransactionalComponentpublic final SysTransState detach()
TransactionalComponentTransactionalComponent.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 null if 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 to TransactionalComponent.attach(SysTransState)
and the transaction ended in the usual way.
detach in interface TransactionalComponentpublic void attach(SysTransState state)
TransactionalComponentsystemState
must be obtained from a call of TransactionalComponent.detach().
This method can only be called once per systemState.attach in interface TransactionalComponentpublic TransactionalComponentLifecycle.ComponentState<X> getComponentState()
public void setComponentState(TransactionalComponentLifecycle.ComponentState<X> state)
Licensed under the Apache License, Version 2.0