public class TransLogger extends Object implements TransactionalComponent
TransactionalComponent lifecycle,
it logs the event.| Constructor and Description |
|---|
TransLogger()
Create a logger for begin-commit/abort-end
|
TransLogger(org.slf4j.Logger logger)
Create a logger, either just begin-commit/abort-end or all steps
|
TransLogger(org.slf4j.Logger logger,
boolean all)
Create a logger, either just begin-commit/abort-end or all steps
|
| 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
|
ComponentId |
getComponentId()
Every component instance must supplied a unique number.
|
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 |
shutdown()
Shutdown component, aborting any in-progress transactions.
|
void |
startRecovery() |
public TransLogger()
public TransLogger(org.slf4j.Logger logger)
public TransLogger(org.slf4j.Logger logger,
boolean all)
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