org.apache.geode.cache

## Interface CacheCallback

- All Superinterfaces:
    Declarable
  All Known Subinterfaces:
    AccessControl, AsyncEventListener, Authenticator, AuthInitialize, CacheListener<K,V>, CacheLoader<K,V>, CacheWriter<K,V>, CqListener, CqStatusListener, CustomExpiry<K,V>, FixedPartitionResolver<K,V>, GatewayEventFilter, GatewayEventSubstitutionFilter<K,V>, GatewayTransportFilter, InterestRegistrationListener, PartitionResolver<K,V>, RegionMembershipListener<K,V>, RegionRoleListener<K,V>, ServerLoadProbe, TransactionListener<K,V>, TransactionWriter
  All Known Implementing Classes:
    org.apache.geode.connectors.jdbc.internal.AbstractJdbcCallback, CacheListenerAdapter, CacheWriterAdapter, CacheXml70DUnitTestHelper.MyAsyncEventListener, CertifiableTestCacheListener, ClientServerTestCase.CacheServerCacheLoader, CloseCacheAuthorization, CqListenerAdapter, CqQueryTestListener, DebugCacheListener, DummyAuthenticator, DummyAuthorization, GatewayDeltaEventApplicationCacheListener, GatewayDeltaForwarderCacheListener, JdbcAsyncWriter, JdbcLoader, JdbcWriter, LdapUserAuthenticator, LocalSessionCacheLoader, LocalSessionCacheWriter, MyGatewayEventFilter1, MyGatewayEventFilter2, MyGatewayTransportFilter1, MyGatewayTransportFilter2, PKCSAuthenticator, PKCSAuthInit, RegionConfigurationCacheListener, RegionMembershipListenerAdapter, RegionRoleListenerAdapter, RegionTestCase.TestExpiry, ServerLoadProbeAdapter, SessionCustomExpiry, SessionExpirationCacheListener, SimpleAccessController, SimpleAuthenticator, StringPrefixPartitionResolver, TestCacheCallback, TestCacheListener, TestCacheLoader, TestCacheWriter, TransactionListenerAdapter, UserPasswordAuthInit, UserPasswordWithExtraPropsAuthInit, XmlAuthorization

      public interface CacheCallback
      extends Declarable

  User-defined objects that can be plugged into caching to receive callback notifications.
  Since:
    GemFire 3.0

- - ### Method Summary

    All Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default 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 interface org.apache.geode.cache.Declarable

      `init, initialize`

- - ### Method Detail

    - #### close

          default 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`.

      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.

      See Also:
        `RegionService.close()`, `Region.close()`, `Region.localDestroyRegion()`, `Region.destroyRegion()`, `AttributesMutator`