File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
server/src/main/java/org/elasticsearch/persistent Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 88 */
99package org .elasticsearch .persistent ;
1010
11+ import org .elasticsearch .core .Strings ;
12+
1113import java .util .Collection ;
1214import java .util .Collections ;
1315import java .util .HashMap ;
@@ -23,7 +25,17 @@ public class PersistentTasksExecutorRegistry {
2325 public PersistentTasksExecutorRegistry (Collection <PersistentTasksExecutor <?>> taskExecutors ) {
2426 Map <String , PersistentTasksExecutor <?>> map = new HashMap <>();
2527 for (PersistentTasksExecutor <?> executor : taskExecutors ) {
26- map .put (executor .getTaskName (), executor );
28+ final var old = map .put (executor .getTaskName (), executor );
29+ if (old != null ) {
30+ final var message = Strings .format (
31+ "task [%s] is already registered with [%s], cannot re-register with [%s]" ,
32+ executor .getTaskName (),
33+ old ,
34+ executor
35+ );
36+ assert false : message ;
37+ throw new IllegalStateException (message );
38+ }
2739 }
2840 this .taskExecutors = Collections .unmodifiableMap (map );
2941 }
You can’t perform that action at this time.
0 commit comments