org.apache.geode.cache30

## Class TestCacheCallback

- java.lang.Object
- - org.apache.geode.cache30.TestCacheCallback

- All Implemented Interfaces:
    CacheCallback, Declarable
  Direct Known Subclasses:
    TestCacheListener, TestCacheLoader, TestCacheWriter

      public abstract class TestCacheCallback
      extends java.lang.Object
      implements CacheCallback

  An abstract superclass of implementation of GemFire cache callbacks that are used for testing.
  Since:
    GemFire 3.0
  See Also:
    `wasInvoked()`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Throwable` | `callbackError`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TestCacheCallback()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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`.
    `void` | `close2()` This method will do nothing.
    `boolean` | `isClosed()`
    `boolean` | `waitForInvocation(int timeoutMs)` Waits up to timeoutMs milliseconds for the listener to be invoked.
    `boolean` | `waitForInvocation(int timeoutMs, long interval)`
    `boolean` | `wasInvoked()` Returns whether or not one of this `CacheListener` methods was invoked.

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

- - ### Field Detail

    - #### callbackError

          protected volatile java.lang.Throwable callbackError

  - ### Constructor Detail

    - #### TestCacheCallback

          public TestCacheCallback()

  - ### Method Detail

    - #### wasInvoked

          public boolean wasInvoked()

      Returns whether or not one of this `CacheListener` methods was invoked. Before returning, the `invoked` flag is cleared.

    - #### waitForInvocation

          public boolean waitForInvocation(int timeoutMs)

      Waits up to timeoutMs milliseconds for the listener to be invoked. Calls wasInvoked and returns its value

    - #### waitForInvocation

          public boolean waitForInvocation(int timeoutMs,
                                           long interval)

    - #### isClosed

          public boolean isClosed()

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

    - #### close2

          public void close2()

      This method will do nothing. Note that it will not throw an exception.