Package org.elasticsearch.common.logging
Class NodeAndClusterIdStateListener
java.lang.Object
org.elasticsearch.common.logging.NodeAndClusterIdStateListener
- All Implemented Interfaces:
ClusterStateObserver.Listener
The
NodeAndClusterIdStateListener listens to cluster state changes and ONLY when receives the first update
it sets the clusterUUID and nodeID in log4j pattern converter NodeAndClusterIdConverter.
Once the first update is received, it will automatically be de-registered from subsequent updates.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidgetAndSetNodeIdAndClusterId(ClusterService clusterService, ThreadContext threadContext)Subscribes for the first cluster state update where nodeId and clusterId is present and sets these values inNodeAndClusterIdConverter.voidcalled when the cluster service is closedvoidonNewClusterState(ClusterState state)called when a new state is observedvoidonTimeout(org.elasticsearch.core.TimeValue timeout)
-
Method Details
-
getAndSetNodeIdAndClusterId
public static void getAndSetNodeIdAndClusterId(ClusterService clusterService, ThreadContext threadContext)Subscribes for the first cluster state update where nodeId and clusterId is present and sets these values inNodeAndClusterIdConverter. -
onNewClusterState
Description copied from interface:ClusterStateObserver.Listenercalled when a new state is observed- Specified by:
onNewClusterStatein interfaceClusterStateObserver.Listener
-
onClusterServiceClose
public void onClusterServiceClose()Description copied from interface:ClusterStateObserver.Listenercalled when the cluster service is closed- Specified by:
onClusterServiceClosein interfaceClusterStateObserver.Listener
-
onTimeout
public void onTimeout(org.elasticsearch.core.TimeValue timeout)- Specified by:
onTimeoutin interfaceClusterStateObserver.Listener
-