/** {@inheritDoc} */ @Override public String igniteInstanceName() { return cfg.getIgniteInstanceName(); }
/** * Gets optional grid name. Returns {@code null} if non-default grid name was not * provided. * <p>The name only works locally and has no effect on topology</p> * * @return Optional grid name. Can be {@code null}, which is default grid name, if * non-default grid name was not provided. * @deprecated Use {@link #getIgniteInstanceName()} instead. */ @Deprecated public String getGridName() { return getIgniteInstanceName(); }
@Override public Void call() throws Exception { startGrid(cfg.getIgniteInstanceName(), cfg); return null; } }, IgniteException.class, null);
@Override public Void call() throws Exception { startGrid(cfg.getIgniteInstanceName(), cfg); return null; } }, IgniteException.class, null);
@Override public Void call() throws Exception { startGrid(cfg.getIgniteInstanceName(), cfg); return null; } }, IgniteException.class, null);
/** {@inheritDoc} */ @Override public String name() { return cfg.getIgniteInstanceName(); }
/** * */ TimeoutWorker() { super( ctx.config().getIgniteInstanceName(), "grid-timeout-worker", GridTimeoutProcessor.this.log, ctx.workersRegistry() ); }
/** * Starts new grid with given configuration. * * @param cfg Ignite configuration. * @return Started grid. * @throws Exception If anything failed. */ protected IgniteEx startGrid(IgniteConfiguration cfg) throws Exception { return (IgniteEx)startGrid(cfg.getIgniteInstanceName(), cfg, null); }
/** * @return Deserialized object. * @throws BinaryObjectException If failed. */ @Nullable Object deserialize() throws BinaryObjectException { String newName = ctx.configuration().getIgniteInstanceName(); String oldName = IgniteUtils.setCurrentIgniteName(newName); try { return deserialize0(); } finally { IgniteUtils.restoreOldIgniteName(oldName, newName); } }
@Override public CacheStore create() { String igniteInstanceName = node.configuration().getIgniteInstanceName(); if (igniteInstanceName.endsWith("1")) return LOCAL_STORE_1; else if (igniteInstanceName.endsWith("2")) return LOCAL_STORE_2; else if (igniteInstanceName.endsWith("3")) return LOCAL_STORE_3; else if (igniteInstanceName.endsWith("4")) return LOCAL_STORE_4; else if (igniteInstanceName.endsWith("5")) return LOCAL_STORE_5; else return LOCAL_STORE_6; } }
/** * Unregisters given MBean. */ private void unregisterMBean() { assert !U.IGNITE_MBEANS_DISABLED; String name = getClass().getSimpleName(); try { ObjectName objName = U.makeMBeanName(ctx.config().getIgniteInstanceName(), "Clients", name); ctx.config().getMBeanServer().unregisterMBean(objName); if (log.isDebugEnabled()) log.debug("Unregistered MBean: " + objName); } catch (JMException e) { U.error(log, "Failed to unregister MBean: " + name, e); } }
/** * @param cfg Ignite configuration. * @throws MalformedObjectNameException Thrown in case of any errors. */ private JmxClusterMetricsHelper(IgniteConfiguration cfg, Class<? extends ClusterMetricsMXBean> clazz) throws MalformedObjectNameException { this.mbeanSrv = cfg.getMBeanServer(); this.mbean = U.makeMBeanName(cfg.getIgniteInstanceName(), "Kernal", clazz.getSimpleName()); }
/** * @param obj Object. * @param enableReplace Object replacing enabled flag. * @throws org.apache.ignite.binary.BinaryObjectException In case of error. */ void marshal(Object obj, boolean enableReplace) throws BinaryObjectException { String newName = ctx.configuration().getIgniteInstanceName(); String oldName = IgniteUtils.setCurrentIgniteName(newName); try { marshal0(obj, enableReplace); } finally { IgniteUtils.restoreOldIgniteName(oldName, newName); } }
/** * @param cfg Configuration. * @return Test builder. */ public JoinNodeTestPlanBuilder nodeConfiguration(IgniteConfiguration cfg) { nodeCfg = cfg; strPlanBuilder.append("Join node:\n") .append(cfg.getIgniteInstanceName()) .append(cfg.isClientMode() != null && cfg.isClientMode() ? " (client)" : "") .append(" activeOnStart - ") .append(cfg.isActiveOnStart()) .append("\n"); CacheConfiguration[] ccfgs = cfg.getCacheConfiguration(); if (ccfgs != null) for (CacheConfiguration ccfg : ccfgs) strPlanBuilder.append(" cache - ").append(ccfg.getName()).append("\n"); return this; }
/** * Register an Ignite MBean for managing clients connections. */ private void registerMBean() throws IgniteCheckedException { assert !U.IGNITE_MBEANS_DISABLED; String name = getClass().getSimpleName(); try { ObjectName objName = U.registerMBean( ctx.config().getMBeanServer(), ctx.config().getIgniteInstanceName(), "Clients", name, new ClientProcessorMXBeanImpl(), ClientProcessorMXBean.class); if (log.isDebugEnabled()) log.debug("Registered MBean: " + objName); } catch (JMException e) { throw new IgniteCheckedException("Failed to register MBean " + name, e); } }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if ("client".equals(cfg.getIgniteInstanceName())) cfg.setClientMode(true); CacheConfiguration<Integer, Value> cc = new CacheConfiguration<>(DEFAULT_CACHE_NAME); cc.setCopyOnRead(true); cc.setIndexedTypes(Integer.class, Value.class); cc.setSqlFunctionClasses(TestSQLFunctions.class); cfg.setCacheConfiguration(cc); return cfg; }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { marsh = grid().configuration().getMarshaller(); igniteInstanceName = grid().configuration().getIgniteInstanceName(); }
/** * @throws Exception If failed. */ @Test public void testSemaphoreClosing() throws Exception { IgniteConfiguration cfg; GridStringLogger stringLogger; stringLogger = new GridStringLogger(); cfg = optimize(getConfiguration("npeGrid")); cfg.setGridLogger(stringLogger); try (Ignite ignite = startGrid(cfg.getIgniteInstanceName(), cfg)) { ignite.semaphore("semaphore", 1, true, true); } assertFalse(stringLogger.toString().contains(NullPointerException.class.getName())); }
/** {@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 Ignite instance name. String igniteInstanceName = cfg.getIgniteInstanceName() + " (" + UUID.randomUUID() + ")"; // Update Ignite instance name (required to be unique). cfg.setIgniteInstanceName(igniteInstanceName); // 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; }
/** * @throws Exception If failed. */ @Test public void testLocalPortRange() throws Exception { try { IgniteConfiguration cfg = getConfiguration(); TcpDiscoverySpi spi = new TcpDiscoverySpi(); spi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); spi.setLocalPortRange(0); cfg.setDiscoverySpi(spi); startGrid(cfg.getIgniteInstanceName(), cfg); } finally { stopAllGrids(); } } }