Skip to content

Commit 5138cfc

Browse files
authored
Minor improvements to ClusterStateObserver docs (#104854)
1 parent 464928b commit 5138cfc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

server/src/main/java/org/elasticsearch/cluster/ClusterStateObserver.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,21 @@ private void logUnexpectedException(Exception exception, String format, Object..
332332

333333
public interface Listener {
334334

335-
/** called when a new state is observed */
335+
/**
336+
* Called when a new state is observed. Implementations should avoid doing heavy operations on the calling thread and fork to
337+
* a threadpool if necessary to avoid blocking the {@link ClusterApplierService}. Note that operations such as sending a new
338+
* request (e.g. via {@link org.elasticsearch.client.internal.Client} or {@link org.elasticsearch.transport.TransportService})
339+
* is cheap enough to be performed without forking.
340+
*/
336341
void onNewClusterState(ClusterState state);
337342

338343
/** called when the cluster service is closed */
339344
void onClusterServiceClose();
340345

346+
/**
347+
* Called when the {@link ClusterStateObserver} times out while waiting for a new matching cluster state if a timeout is
348+
* used when creating the observer. Upon timeout, {@code onTimeout} is called on the GENERIC threadpool.
349+
*/
341350
void onTimeout(TimeValue timeout);
342351
}
343352

0 commit comments

Comments
 (0)