Class TopologyHandler

java.lang.Object
org.apache.sling.event.impl.jobs.config.TopologyHandler
All Implemented Interfaces:
Runnable, TopologyEventListener

public class TopologyHandler extends Object implements TopologyEventListener, Runnable
This topology handler is handling the topology change events asynchronously and processes them by queuing them.
  • Constructor Details

    • TopologyHandler

      public TopologyHandler()
  • Method Details

    • activate

      protected void activate()
    • deactivate

      protected void deactivate()
    • handleTopologyEvent

      public void handleTopologyEvent(TopologyEvent event)
      Description copied from interface: TopologyEventListener
      Inform the service about an event in the topology - or in the discovery of the topology.

      Implementors of this method must ensure that this method returns quickly and that no locks are being acquired that could cause deadlocks (ie the framework might call this method holding locks).

      The TopologyEvent contains details about what changed. The supported event types are:

      • TOPOLOGY_INIT sent when the TopologyEventListener was first bound to the discovery service - represents the initial state of the topology at that time.
      • TOPOLOGY_CHANGING sent when the discovery service discovered a change in the topology and has started to settle the change. This event is sent before TOPOLOGY_CHANGED but is optional
      • TOPOLOGY_CHANGED sent when the discovery service discovered a change in the topology and has settled it.
      • PROPERTIES_CHANGED sent when the one or many properties have changed in an instance in the current topology
      A note on instance restarts: it is currently not a requirement on the discovery service to send a TopologyEvent should an instance restart occur rapidly (ie within the change detection timeout). A TopologyEvent is only sent if the number of instances or any property changes. Should there be a requirement to detect a restart in a guaranteed fashion, it is always possible to set a particular property (using the PropertyProvider) to the instance start time and have others detect a change in that property.
      Specified by:
      handleTopologyEvent in interface TopologyEventListener
      Parameters:
      event - The topology event
    • run

      public void run()
      Specified by:
      run in interface Runnable