Class Transactional.AbstractTransactional
- java.lang.Object
-
- org.apache.cassandra.utils.concurrent.Transactional.AbstractTransactional
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,Transactional
- Direct Known Subclasses:
CompactionAwareWriter
,CompressionMetadata.Writer
,LifecycleTransaction
,SequentialWriter.TransactionalProxy
,SortedTableWriter.AbstractIndexWriter
,SSTableRewriter
,SSTableTxnWriter
,SSTableWriter.TransactionalProxy
- Enclosing interface:
- Transactional
public abstract static class Transactional.AbstractTransactional extends java.lang.Object implements Transactional
A simple abstract implementation of Transactional behaviour. In general this should be used as the base class for any transactional implementations. If the implementation wraps any internal Transactional objects, it must proxy every commit() and abort() call onto each internal object to ensure correct behaviour
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Transactional.AbstractTransactional.State
-
Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Transactional
Transactional.AbstractTransactional
-
-
Constructor Summary
Constructors Constructor Description AbstractTransactional()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
abort()
java.lang.Throwable
abort(java.lang.Throwable accumulate)
rollback any effects of this transaction object graph; delegates first to doCleanup, then to doAbortvoid
close()
void
commit()
java.lang.Throwable
commit(java.lang.Throwable accumulate)
commit any effects of this transaction object graph, then cleanup; delegates first to doCommit, then to doCleanupprotected abstract java.lang.Throwable
doAbort(java.lang.Throwable accumulate)
protected abstract java.lang.Throwable
doCommit(java.lang.Throwable accumulate)
protected java.lang.Throwable
doPostCleanup(java.lang.Throwable accumulate)
perform an exception-safe post-abort cleanupprotected java.lang.Throwable
doPreCleanup(java.lang.Throwable accumulate)
perform an exception-safe pre-abort/commit cleanup; this will be run after prepareToCommit (so before commit), and before abortprotected abstract void
doPrepare()
Do any preparatory work prior to commit.java.lang.Object
finish()
convenience method to both prepareToCommit() and commit() in one operation; only of use to outer-most transactional object of an object graphvoid
prepareToCommit()
The first phase of commit: delegates to doPrepare(), with valid state transition enforcement.Transactional.AbstractTransactional.State
state()
-
-
-
Method Detail
-
doCommit
protected abstract java.lang.Throwable doCommit(java.lang.Throwable accumulate)
-
doAbort
protected abstract java.lang.Throwable doAbort(java.lang.Throwable accumulate)
-
doPreCleanup
protected java.lang.Throwable doPreCleanup(java.lang.Throwable accumulate)
perform an exception-safe pre-abort/commit cleanup; this will be run after prepareToCommit (so before commit), and before abort
-
doPostCleanup
protected java.lang.Throwable doPostCleanup(java.lang.Throwable accumulate)
perform an exception-safe post-abort cleanup
-
doPrepare
protected abstract void doPrepare()
Do any preparatory work prior to commit. This method should throw any exceptions that can be encountered during the finalization of the behaviour.
-
commit
public final java.lang.Throwable commit(java.lang.Throwable accumulate)
commit any effects of this transaction object graph, then cleanup; delegates first to doCommit, then to doCleanup- Specified by:
commit
in interfaceTransactional
-
abort
public final java.lang.Throwable abort(java.lang.Throwable accumulate)
rollback any effects of this transaction object graph; delegates first to doCleanup, then to doAbort- Specified by:
abort
in interfaceTransactional
-
close
public final void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceTransactional
-
prepareToCommit
public final void prepareToCommit()
The first phase of commit: delegates to doPrepare(), with valid state transition enforcement. This call should be propagated onto any child objects participating in the transaction- Specified by:
prepareToCommit
in interfaceTransactional
-
finish
public java.lang.Object finish()
convenience method to both prepareToCommit() and commit() in one operation; only of use to outer-most transactional object of an object graph
-
abort
public final void abort()
-
commit
public final void commit()
-
state
public final Transactional.AbstractTransactional.State state()
-
-