Skip to content

Commit 1b7eeb4

Browse files
committed
Make clusterStatePublished method final in ClusterStateUpdateTask
1 parent 7ec662f commit 1b7eeb4

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public String describeTasks(List<ClusterStateUpdateTask> tasks) {
6262
*/
6363
public abstract void onFailure(String source, Exception e);
6464

65+
@Override
66+
public final void clusterStatePublished(ClusterChangedEvent clusterChangedEvent) {
67+
// final, empty implementation here as this method should only be defined in combination
68+
// with a batching executor as it will always be executed within the system context.
69+
}
70+
6571
/**
6672
* If the cluster state update task wasn't processed by the provided timeout, call
6773
* {@link ClusterStateTaskListener#onFailure(String, Exception)}. May return null to indicate no timeout is needed (default).

server/src/test/java/org/elasticsearch/cluster/service/MasterServiceTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,6 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS
209209
latch.countDown();
210210
}
211211

212-
@Override
213-
public void clusterStatePublished(ClusterChangedEvent clusterChangedEvent) {
214-
assertTrue(threadPool.getThreadContext().isSystemContext());
215-
assertEquals(Collections.emptyMap(), threadPool.getThreadContext().getHeaders());
216-
latch.countDown();
217-
}
218-
219212
@Override
220213
protected Void newResponse(boolean acknowledged) {
221214
return null;

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/DeleteJobIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void onFailure(String source, Exception e) {
4747
}
4848

4949
@Override
50-
public void clusterStatePublished(ClusterChangedEvent clusterChangedEvent) {
50+
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
5151
markAsDeletedLatch.countDown();
5252
}
5353
});
@@ -90,7 +90,7 @@ public void onFailure(String source, Exception e) {
9090
}
9191

9292
@Override
93-
public void clusterStatePublished(ClusterChangedEvent clusterChangedEvent) {
93+
public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) {
9494
removeJobLatch.countDown();
9595
}
9696
});

0 commit comments

Comments
 (0)