public class TransMonitor extends Object implements TransactionalComponent
TransactionalComponent operations.
For each operation called "ABC" there is a member field "counterABC".| Constructor and Description |
|---|
TransMonitor(ComponentId cid) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Transaction transaction)
Abort a transaction (undo the effect of a transaction)
|
void |
attach(SysTransState systemState)
Set the current thread to be in the transaction.
|
void |
begin(Transaction transaction)
Start a transaction; return an identifier for this components use.
|
void |
cleanStart()
Indicate that no recovery is being done (the journal thinks everything was completed last time)
|
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)
Prepare for a commit.
|
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) |
void |
finishRecovery()
End of the recovery phase
|
Map<String,Long> |
getAll()
Get a copy of the counters with current values.
|
ComponentId |
getComponentId()
Every component instance must supplied a unique number.
|
void |
print()
Print the counters state.
|
void |
print(PrintStream ps)
Print the counters state.
|
boolean |
promote(Transaction transaction)
Promote a component in a transaction.
|
void |
recover(ByteBuffer ref)
Notification that
ref was really committed and is being recovered. |
void |
reset()
Reset all counters to zero
|
void |
shutdown()
Shutdown component, aborting any in-progress transactions.
|
void |
startRecovery() |
public LongAdder counterGetComponentId
public LongAdder counterStartRecovery
public LongAdder counterRecover
public LongAdder counterFinishRecovery
public LongAdder counterCleanStart
public LongAdder counterBegin
public LongAdder counterPromote
public LongAdder counterCommitPrepare
public LongAdder counterCommit
public LongAdder counterCommitEnd
public LongAdder counterAbort
public LongAdder counterComplete
public LongAdder counterDetach
public LongAdder counterAttach
public LongAdder counterShutdown
public TransMonitor(ComponentId cid)
public void reset()
public Map<String,Long> getAll()
public void print()
public void print(PrintStream ps)
public 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 void startRecovery()
startRecovery in interface TransactionalComponentpublic 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 void finishRecovery()
TransactionalComponentfinishRecovery in interface TransactionalComponentpublic void cleanStart()
TransactionalComponentcleanStart in interface TransactionalComponentpublic void begin(Transaction transaction)
TransactionalComponentbegin in interface TransactionalComponentpublic boolean promote(Transaction transaction)
TransactionalComponentMay return "false" for "can't do that" if the transaction can not be promoted.
May throw UnsupportedOperationException if promotion is not supported.
promote in interface TransactionalComponentpublic ByteBuffer commitPrepare(Transaction transaction)
TransactionalComponentTransactionalComponent.commitEnd(org.apache.jena.dboe.transaction.txn.Transaction) is called.commitPrepare in interface TransactionalComponentpublic void commit(Transaction transaction)
TransactionalComponentcommit in interface TransactionalComponentpublic void commitEnd(Transaction transaction)
TransactionalComponentcommitEnd in interface TransactionalComponentpublic void abort(Transaction transaction)
TransactionalComponentabort in interface TransactionalComponentpublic void complete(Transaction transaction)
TransactionalComponentcomplete in interface TransactionalComponentpublic 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 systemState)
TransactionalComponentsystemState
must be obtained from a call of TransactionalComponent.detach().
This method can only be called once per systemState.attach in interface TransactionalComponentpublic void shutdown()
TransactionalComponentshutdown in interface TransactionalComponentLicensed under the Apache License, Version 2.0