96
96
import org .elasticsearch .gateway .GatewayService ;
97
97
import org .elasticsearch .gateway .MetaStateService ;
98
98
import org .elasticsearch .gateway .PersistedClusterStateService ;
99
- import org .elasticsearch .health .HealthIndicatorService ;
100
99
import org .elasticsearch .health .HealthService ;
101
100
import org .elasticsearch .http .HttpServerTransport ;
102
101
import org .elasticsearch .index .IndexSettingProviders ;
@@ -865,7 +864,7 @@ protected Node(
865
864
metadataCreateIndexService ,
866
865
settingsModule .getIndexScopedSettings ()
867
866
);
868
- final List <PersistentTasksExecutor <?>> builtinTaskExecutors = Arrays . asList (systemIndexMigrationExecutor );
867
+ final List <PersistentTasksExecutor <?>> builtinTaskExecutors = List . of (systemIndexMigrationExecutor );
869
868
final List <PersistentTasksExecutor <?>> pluginTaskExectors = pluginsService .filterPlugins (PersistentTaskPlugin .class )
870
869
.stream ()
871
870
.map (
@@ -879,10 +878,9 @@ protected Node(
879
878
)
880
879
.flatMap (List ::stream )
881
880
.collect (toList ());
882
- final List <PersistentTasksExecutor <?>> allTasksExectors = Stream .of (pluginTaskExectors , builtinTaskExecutors )
883
- .flatMap (List ::stream )
884
- .collect (toList ());
885
- final PersistentTasksExecutorRegistry registry = new PersistentTasksExecutorRegistry (allTasksExectors );
881
+ final PersistentTasksExecutorRegistry registry = new PersistentTasksExecutorRegistry (
882
+ concatLists (pluginTaskExectors , builtinTaskExecutors )
883
+ );
886
884
final PersistentTasksClusterService persistentTasksClusterService = new PersistentTasksClusterService (
887
885
settings ,
888
886
registry ,
@@ -901,15 +899,7 @@ protected Node(
901
899
clusterService .getClusterSettings ()
902
900
);
903
901
904
- List <HealthIndicatorService > serverHealthIndicatorServices = List .of (
905
- new InstanceHasMasterHealthIndicatorService (clusterService ),
906
- new RepositoryIntegrityHealthIndicatorService (clusterService )
907
- );
908
- List <HealthIndicatorService > pluginHealthIndicatorServices = pluginsService .filterPlugins (HealthPlugin .class )
909
- .stream ()
910
- .flatMap (plugin -> plugin .getHealthIndicatorServices ().stream ())
911
- .toList ();
912
- HealthService healthService = new HealthService (concatLists (serverHealthIndicatorServices , pluginHealthIndicatorServices ));
902
+ HealthService healthService = createHealthService (clusterService );
913
903
914
904
modules .add (b -> {
915
905
b .bind (Node .class ).toInstance (this );
@@ -1042,6 +1032,18 @@ protected Node(
1042
1032
}
1043
1033
}
1044
1034
1035
+ private HealthService createHealthService (ClusterService clusterService ) {
1036
+ var serverHealthIndicatorServices = List .of (
1037
+ new InstanceHasMasterHealthIndicatorService (clusterService ),
1038
+ new RepositoryIntegrityHealthIndicatorService (clusterService )
1039
+ );
1040
+ var pluginHealthIndicatorServices = pluginsService .filterPlugins (HealthPlugin .class )
1041
+ .stream ()
1042
+ .flatMap (plugin -> plugin .getHealthIndicatorServices ().stream ())
1043
+ .toList ();
1044
+ return new HealthService (concatLists (serverHealthIndicatorServices , pluginHealthIndicatorServices ));
1045
+ }
1046
+
1045
1047
private RecoveryPlannerService getRecoveryPlannerService (
1046
1048
ThreadPool threadPool ,
1047
1049
ClusterService clusterService ,
@@ -1062,8 +1064,7 @@ private RecoveryPlannerService getRecoveryPlannerService(
1062
1064
threadPool ,
1063
1065
clusterService
1064
1066
);
1065
- final RecoveryPlannerPlugin recoveryPlannerPlugin = recoveryPlannerPlugins .get (0 );
1066
- return recoveryPlannerPlugin .createRecoveryPlannerService (shardSnapshotsService );
1067
+ return recoveryPlannerPlugins .get (0 ).createRecoveryPlannerService (shardSnapshotsService );
1067
1068
}
1068
1069
1069
1070
protected TransportService newTransportService (
0 commit comments