Pivotal GemFire® v9.0

Launching an Application after Initializing the Cache

You can specify a callback application that is launched after the cache initialization.

By specifying an <initializer> element in your cache.xml file, you can trigger a callback application, which is run after the cache has been initialized. Applications that use the cacheserver script to start up a server can also use this feature to hook into a callback application. To use this feature, you need to specify the callback class within the <initializer> element. This element should be added to the end of your cache.xml file.

You can specify the <initializer> element for either server caches or client caches.

The callback class must implement the Declarable interface. When the callback class is loaded, its init method is called, and any parameters defined in the <initializer> element are passed as properties.

The following is an example specification.

In cache.xml:

      <parameter name="members">

Here’s the corresponding class definition:

import org.apache.geode.cache.Declarable;

public class MyInitializer implements Declarable {
   public void init(Properties properties) {

The following are some additional real-world usage scenarios:

  1. Start a SystemMembershipListener

  2. Write a custom tool that monitors cache resources


Any singleton or timer task or thread can be instantiated and started using the initializer element.