diff --git a/server/src/main/java/org/elasticsearch/node/Node.java b/server/src/main/java/org/elasticsearch/node/Node.java index 91d1fd2a512..f1dbffd7ec4 100644 --- a/server/src/main/java/org/elasticsearch/node/Node.java +++ b/server/src/main/java/org/elasticsearch/node/Node.java @@ -264,21 +264,21 @@ public class Node implements Closeable { /** * Constructs a node * - * @param environment the environment for this node + * @param initialEnvironment the initial environment for this node, which will be added to by plugins * @param classpathPlugins the plugins to be loaded from the classpath * @param forbidPrivateIndexSettings whether or not private index settings are forbidden when creating an index; this is used in the * test framework for tests that rely on being able to set private settings */ - protected Node( - final Environment environment, Collection> classpathPlugins, boolean forbidPrivateIndexSettings) { + protected Node(final Environment initialEnvironment, + Collection> classpathPlugins, boolean forbidPrivateIndexSettings) { logger = LogManager.getLogger(Node.class); final List resourcesToClose = new ArrayList<>(); // register everything we need to release in the case of an error boolean success = false; try { - Settings tmpSettings = Settings.builder().put(environment.settings()) + Settings tmpSettings = Settings.builder().put(initialEnvironment.settings()) .put(Client.CLIENT_TYPE_SETTING_S.getKey(), CLIENT_TYPE).build(); - nodeEnvironment = new NodeEnvironment(tmpSettings, environment); + nodeEnvironment = new NodeEnvironment(tmpSettings, initialEnvironment); resourcesToClose.add(nodeEnvironment); logger.info("node name [{}], node ID [{}], cluster name [{}]", NODE_NAME_SETTING.get(tmpSettings), nodeEnvironment.nodeId(), @@ -310,11 +310,12 @@ public class Node implements Closeable { if (logger.isDebugEnabled()) { logger.debug("using config [{}], data [{}], logs [{}], plugins [{}]", - environment.configFile(), Arrays.toString(environment.dataFiles()), environment.logsFile(), environment.pluginsFile()); + initialEnvironment.configFile(), Arrays.toString(initialEnvironment.dataFiles()), + initialEnvironment.logsFile(), initialEnvironment.pluginsFile()); } - this.pluginsService = new PluginsService(tmpSettings, environment.configFile(), environment.modulesFile(), - environment.pluginsFile(), classpathPlugins); + this.pluginsService = new PluginsService(tmpSettings, initialEnvironment.configFile(), initialEnvironment.modulesFile(), + initialEnvironment.pluginsFile(), classpathPlugins); final Settings settings = pluginsService.updatedSettings(); final Set possibleRoles = Stream.concat( DiscoveryNodeRole.BUILT_IN_ROLES.stream(), @@ -328,8 +329,8 @@ public class Node implements Closeable { // create the environment based on the finalized (processed) view of the settings // this is just to makes sure that people get the same settings, no matter where they ask them from - this.environment = new Environment(settings, environment.configFile()); - Environment.assertEquivalent(environment, this.environment); + this.environment = new Environment(settings, initialEnvironment.configFile()); + Environment.assertEquivalent(initialEnvironment, this.environment); final List> executorBuilders = pluginsService.getExecutorBuilders(settings);