/** @throws Exception If failed. */ public void testStartMultipleInstanceSpi() throws Exception { IgniteConfiguration cfg1 = getConfiguration(); IgniteConfiguration cfg2 = getConfiguration(); IgniteConfiguration cfg3 = getConfiguration(); cfg1.setCollisionSpi(new TestMultipleInstancesCollisionSpi()); cfg2.setCollisionSpi(new TestMultipleInstancesCollisionSpi()); cfg3.setCollisionSpi(new TestMultipleInstancesCollisionSpi()); cfg2.setGridName(getTestGridName() + '1'); G.start(cfg2); G.start(cfg1); cfg3.setGridName(getTestGridName() + '2'); G.start(cfg3); assert G.state(cfg1.getGridName()) == STARTED; assert G.state(getTestGridName() + '1') == STARTED; assert G.state(getTestGridName() + '2') == STARTED; G.stop(getTestGridName() + '2', false); G.stop(cfg1.getGridName(), false); G.stop(getTestGridName() + '1', false); assert G.state(cfg1.getGridName()) == STOPPED; assert G.state(getTestGridName() + '1') == STOPPED; assert G.state(getTestGridName() + '2') == STOPPED; }
/** {@inheritDoc} */ @Override protected Object executeJob(int gridSize, String type) { log.info(">>> Starting new grid node [currGridSize=" + gridSize + ", arg=" + type + "]"); if (type == null) throw new IllegalArgumentException("Node type to start should be specified."); IgniteConfiguration cfg = getConfig(type); // Generate unique for this VM grid name. String gridName = cfg.getGridName() + " (" + UUID.randomUUID() + ")"; // Update grid name (required to be unique). cfg.setGridName(gridName); // Start new node in current VM. Ignite g = G.start(cfg); log.info( ">>> Grid started [nodeId=" + g.cluster().localNode().id() + ", name='" + g.name() + "']"); return true; }
/** {@inheritDoc} */ @Override public String gridName() { return cfg.getGridName(); }