public class InitDelayingTopologyEventListener extends Object implements TopologyEventListener
What happens aFter the startup time depends on what was received during the delay:
Constructor and Description |
---|
InitDelayingTopologyEventListener(long startupDelay,
TopologyEventListener delegate)
Creates a new init-delaying listener with the given delay, delegate and scheduler.
|
InitDelayingTopologyEventListener(long startupDelay,
TopologyEventListener delegate,
org.slf4j.Logger loggerOrNull)
Creates a new init-delaying listener with the given delay, delegate, scheduler and optinoal logger.
|
InitDelayingTopologyEventListener(long startupDelay,
TopologyEventListener delegate,
Scheduler scheduler)
Deprecated.
|
InitDelayingTopologyEventListener(long startupDelay,
TopologyEventListener delegate,
Scheduler scheduler,
org.slf4j.Logger loggerOrNull)
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Marks this listener as no longer active - ensures that it doesn't call the delegate
via any potentially pending scheduler callback.
|
void |
handleTopologyEvent(TopologyEvent event)
Inform the service about an event in the topology - or in the discovery
of the topology.
|
public InitDelayingTopologyEventListener(long startupDelay, TopologyEventListener delegate)
For properly disposing the caller should use the dispose method!
startupDelay
- The startup delay in secondsdelegate
- The topology event listenerdispose()
public InitDelayingTopologyEventListener(long startupDelay, TopologyEventListener delegate, org.slf4j.Logger loggerOrNull)
For properly disposing the caller should use the dispose method!
startupDelay
- The startup delay in secondsdelegate
- The topology event listenerloggerOrNull
- Optional logger instancedispose()
@Deprecated public InitDelayingTopologyEventListener(long startupDelay, TopologyEventListener delegate, Scheduler scheduler)
InitDelayingTopologyEventListener(long, TopologyEventListener)
For properly disposing the caller should use the dispose method!
startupDelay
- The startup delay in secondsdelegate
- The topology event listenerscheduler
- Scheduler to schedule the delay (not used)dispose()
@Deprecated public InitDelayingTopologyEventListener(long startupDelay, TopologyEventListener delegate, Scheduler scheduler, org.slf4j.Logger loggerOrNull)
For properly disposing the caller should use the dispose method!
startupDelay
- The startup delay in secondsdelegate
- The topology event listenerscheduler
- Scheduler to schedule the delay (not used)loggerOrNull
- Optional logger instancedispose()
public void handleTopologyEvent(TopologyEvent event)
TopologyEventListener
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 optionalTOPOLOGY_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 topologyhandleTopologyEvent
in interface TopologyEventListener
event
- The topology eventpublic void dispose()
Note that after dispose you can *still* call handleTopologyEvent and the events are passed to the delegate - but those are expected to be 'late' events and not really part of the normal game. Hence, the caller must also ensure that the handleTopologyEvent method isn't called anymore (which typically is automatically guaranteed since the caller is typically an osgi service that gets unregistered anyway)
Copyright © 2017 The Apache Software Foundation. All rights reserved.