org.apache.cassandra.utils.concurrent

## 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, SSTableRewriter, 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 and Description
    --- | ---
    `static class` | `Transactional.AbstractTransactional.State`

    - ### Nested classes/interfaces inherited from interface org.apache.cassandra.utils.concurrent.Transactional

      `Transactional.AbstractTransactional`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTransactional()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and 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 doAbort
    `void` | `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 doCleanup
    `protected 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 cleanup
    `protected java.lang.Throwable` | `doPreCleanup(java.lang.Throwable accumulate)` perform an exception-safe pre-abort cleanup; this will still be run *after* commit
    `protected 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 graph
    `protected void` | `permitRedundantTransitions()`
    `void` | `prepareToCommit()` The first phase of commit: delegates to doPrepare(), with valid state transition enforcement.
    `Transactional.AbstractTransactional.State` | `state()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractTransactional

          public AbstractTransactional()

  - ### 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 cleanup; this will still be run *after* commit

    - #### 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 interface `Transactional`

    - #### 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 interface `Transactional`

    - #### close

          public final void close()

      Specified by:
        `close` in interface `java.lang.AutoCloseable`

    - #### 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 interface `Transactional`

    - #### 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()

    - #### permitRedundantTransitions

          protected void permitRedundantTransitions()

Copyright © 2018 The Apache Software Foundation