org.apache.geode.cache.util

## Class TransactionListenerAdapter

- java.lang.Object
- - org.apache.geode.cache.util.TransactionListenerAdapter

- All Implemented Interfaces:
    CacheCallback, Declarable, TransactionListener

      public abstract class TransactionListenerAdapter
      extends java.lang.Object
      implements TransactionListener

  Utility class that implements all methods in `TransactionListener` with empty implementations. Applications can subclass this class and only override the methods for the events of interest.
  Since:
    GemFire 5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransactionListenerAdapter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterCommit(TransactionEvent event)` Called after a successful commit of a transaction.
    `void` | `afterFailedCommit(TransactionEvent event)` Called after an unsuccessful commit operation.
    `void` | `afterRollback(TransactionEvent event)` Called after an explicit rollback of a transaction.
    `void` | `close()` Called when the region containing this callback is closed or destroyed, when the cache is closed, or when a callback is removed from a region using an `AttributesMutator`.

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

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

    - ### Methods inherited from interface org.apache.geode.cache.Declarable

      `init, initialize`

- - ### Constructor Detail

    - #### TransactionListenerAdapter

          public TransactionListenerAdapter()

  - ### Method Detail

    - #### afterCommit

          public void afterCommit(TransactionEvent event)

      Description copied from interface: `TransactionListener`
      Called after a successful commit of a transaction.
      Specified by:
        `afterCommit` in interface `TransactionListener`
      Parameters:
        `event` - the TransactionEvent
      See Also:
        `CacheTransactionManager.commit()`

    - #### afterFailedCommit

          public void afterFailedCommit(TransactionEvent event)

      Description copied from interface: `TransactionListener`
      Called after an unsuccessful commit operation.
      Specified by:
        `afterFailedCommit` in interface `TransactionListener`
      Parameters:
        `event` - the TransactionEvent
      See Also:
        `CacheTransactionManager.commit()`

    - #### afterRollback

          public void afterRollback(TransactionEvent event)

      Description copied from interface: `TransactionListener`
      Called after an explicit rollback of a transaction.
      Specified by:
        `afterRollback` in interface `TransactionListener`
      Parameters:
        `event` - the TransactionEvent
      See Also:
        `CacheTransactionManager.rollback()`, `CacheTransactionManager.commit()`

    - #### close

          public void close()

      Description copied from interface: `CacheCallback`
      Called when the region containing this callback is closed or destroyed, when the cache is closed, or when a callback is removed from a region using an `AttributesMutator`.

      Implementations should cleanup any external resources such as database connections. Any runtime exceptions this method throws will be logged.

      It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.

      Specified by:
        `close` in interface `CacheCallback`
      See Also:
        `RegionService.close()`, `Region.close()`, `Region.localDestroyRegion()`, `Region.destroyRegion()`, `AttributesMutator`