#ignite-239: review.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4ff4fd1d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4ff4fd1d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4ff4fd1d Branch: refs/heads/ignite-237 Commit: 4ff4fd1d7ad0d7691bb911a5453d69d1a5ac627f Parents: d1b9436 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Feb 27 18:14:15 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Feb 27 18:14:15 2015 +0300 ---------------------------------------------------------------------- .../org/apache/ignite/internal/IgnitionEx.java | 77 ++++++++++---------- 1 file changed, 38 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4ff4fd1d/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java index ca3abe9..6b8b197 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java @@ -1295,51 +1295,19 @@ public class IgnitionEx { private void start0(GridStartContext startCtx) throws IgniteCheckedException { assert grid == null : "Grid is already started: " + name; - IgniteConfiguration cfg = startCtx.config() != null ? startCtx.config() : new IgniteConfiguration(); - - String ggHome = cfg.getIgniteHome(); - - // Set Ignite home. - if (ggHome == null) - ggHome = U.getIgniteHome(); - else - // If user provided IGNITE_HOME - set it as a system property. - U.setIgniteHome(ggHome); + // Set configuration URL, if any, into system property. + if (startCtx.configUrl() != null) + System.setProperty(IGNITE_CONFIG_URL, startCtx.configUrl().toString()); - U.setWorkDirectory(cfg.getWorkDirectory(), ggHome); + IgniteConfiguration cfg = startCtx.config() != null ? startCtx.config() : new IgniteConfiguration(); // Ensure invariant. // It's a bit dirty - but this is a result of late refactoring // and I don't want to reshuffle a lot of code. assert F.eq(name, cfg.getGridName()); - // Set configuration URL, if any, into system property. - if (startCtx.configUrl() != null) - System.setProperty(IGNITE_CONFIG_URL, startCtx.configUrl().toString()); - - // Initialize factory's log. - UUID nodeId = cfg.getNodeId() != null ? cfg.getNodeId() : UUID.randomUUID(); - - IgniteLogger cfgLog = initLogger(cfg.getGridLogger(), nodeId); - - assert cfgLog != null; - - cfgLog = new GridLoggerProxy(cfgLog, null, name, U.id8(nodeId)); - - log = cfgLog.getLogger(G.class); - - // Check Ignite home folder (after log is available). - if (ggHome != null) { - File ggHomeFile = new File(ggHome); - - if (!ggHomeFile.exists() || !ggHomeFile.isDirectory()) - throw new IgniteCheckedException("Invalid Ignite installation home folder: " + ggHome); - } - IgniteConfiguration myCfg = initializeConfiguration(cfg); - myCfg.setGridLogger(cfgLog); - // Validate segmentation configuration. GridSegmentationPolicy segPlc = cfg.getSegmentationPolicy(); @@ -1521,9 +1489,41 @@ public class IgnitionEx { */ private IgniteConfiguration initializeConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException { + // Initialize factory's log. + UUID nodeId = cfg.getNodeId() != null ? cfg.getNodeId() : UUID.randomUUID(); + + IgniteLogger cfgLog = initLogger(cfg.getGridLogger(), nodeId); + + assert cfgLog != null; + + cfgLog = new GridLoggerProxy(cfgLog, null, name, U.id8(nodeId)); + + log = cfgLog.getLogger(G.class); + + String ggHome = cfg.getIgniteHome(); + + // Set Ignite home. + if (ggHome == null) + ggHome = U.getIgniteHome(); + else + // If user provided IGNITE_HOME - set it as a system property. + U.setIgniteHome(ggHome); + + U.setWorkDirectory(cfg.getWorkDirectory(), ggHome); + + // Check Ignite home folder (after log is available). + if (ggHome != null) { + File ggHomeFile = new File(ggHome); + + if (!ggHomeFile.exists() || !ggHomeFile.isDirectory()) + throw new IgniteCheckedException("Invalid Ignite installation home folder: " + ggHome); + } + IgniteConfiguration myCfg = new IgniteConfiguration(cfg); - myCfg.setIgniteHome(U.getIgniteHome()); + myCfg.setIgniteHome(ggHome); + + myCfg.setGridLogger(cfgLog); // Local host. String locHost = IgniteSystemProperties.getString(IGNITE_LOCAL_HOST); @@ -1606,8 +1606,7 @@ public class IgnitionEx { if (myCfg.getMBeanServer() == null) myCfg.setMBeanServer(ManagementFactory.getPlatformMBeanServer()); - if (myCfg.getNodeId() == null) - myCfg.setNodeId(UUID.randomUUID()); + myCfg.setNodeId(nodeId); if (myCfg.getPeerClassLoadingLocalClassPathExclude() == null) myCfg.setPeerClassLoadingLocalClassPathExclude(EMPTY_STR_ARR);