Module org.elasticsearch.server
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 NodeIdConverter
.
Once the first update is received, it will automatically be de-registered from subsequent updates.-
Method Summary
Modifier and TypeMethodDescriptionstatic void
getAndSetNodeIdAndClusterId
(ClusterService clusterService, ThreadContext threadContext) Subscribes for the first cluster state update where nodeId and clusterId is present and sets these values inNodeIdConverter
.void
called when the cluster service is closedvoid
onNewClusterState
(ClusterState state) called when a new state is observedvoid
-
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 inNodeIdConverter
. -
onNewClusterState
Description copied from interface:ClusterStateObserver.Listener
called when a new state is observed- Specified by:
onNewClusterState
in interfaceClusterStateObserver.Listener
-
onClusterServiceClose
public void onClusterServiceClose()Description copied from interface:ClusterStateObserver.Listener
called when the cluster service is closed- Specified by:
onClusterServiceClose
in interfaceClusterStateObserver.Listener
-
onTimeout
- Specified by:
onTimeout
in interfaceClusterStateObserver.Listener
-