Refine search
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = new IgniteConfiguration(); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setIgniteInstanceName(igniteInstanceName); cfg.setMarshaller(new BinaryMarshaller()); cfg.setDiscoverySpi(discoSpi); cfg.setFileSystemConfiguration(igfsConfiguration(igniteInstanceName)); cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED); cfg.setFailureHandler(new NoOpFailureHandler()); return cfg; }
/** * @param name Name. * @param client Client. */ private static IgniteConfiguration config(String name, boolean client, boolean forceServerMode) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(name); cfg.setClientMode(client); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setForceServerMode(forceServerMode); disco.setIpFinder(sharedStaticIpFinder); cfg.setDiscoverySpi(disco); return cfg; } }
/** * @param type Type name to check. * @return {@code True} if class not found. */ protected TypeKind kindForName(String type) { return kindForName(type, ignite.configuration().getMarshaller() instanceof BinaryMarshaller); }
/** * @return Ignite config. */ @Override public IgniteConfiguration igniteConfiguration() { IgniteConfiguration config = new IgniteConfiguration(); config.setIgniteInstanceName("testGrid"); return config; }
/** * Create config. * * @param name Name. * @param client Client flag. * @return Config. */ private static IgniteConfiguration config(String name, boolean client) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(name); cfg.setClientMode(client); return cfg; } }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration() throws Exception { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setDiscoverySpi(new TcpDiscoverySpi()); return cfg; }
this.cfg = cfg; this.locJvmGrid = locJvmGrid; this.log = logger(log, "jvm-" + id.toString().substring(0, id.toString().indexOf('-'))); filteredJvmArgs.addAll(additionalArgs); final CountDownLatch rmtNodeStartedLatch = new CountDownLatch(1); locJvmGrid.events().localListen(new NodeStartedListener(id, rmtNodeStartedLatch), EventType.EVT_NODE_JOINED); assert rmtNodeStartedLatch.await(30, TimeUnit.SECONDS): "Remote node has not joined [id=" + id + ']'; IgniteProcessProxy prevVal = gridProxies.putIfAbsent(cfg.getIgniteInstanceName(), this); remoteCompute().run(new StopGridTask(cfg.getIgniteInstanceName(), true)); throw new IllegalStateException("There was found instance assotiated with " + cfg.getIgniteInstanceName() + ", instance= " + prevVal + ". New started node was stopped.");
assert futId == null; IgniteCache<?, ?> cache = ignite.cache(cacheName); boolean start = ignite.configuration().isClientMode(); futId = UUID.randomUUID(); ConcurrentMap<UUID,Cursor> m = ignite.cluster().nodeLocalMap();
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (cnt.getAndIncrement() == 0 || (cnt.get() > gridCount() && cnt.get() % gridCount() == 0)) { info("Use grid '" + igniteInstanceName + "' as near-only."); cfg.setClientMode(true); cfg.setCacheConfiguration(); } return cfg; }
/** {@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; }
public void testDeployOnEachProjectionNodeUpdateTopology() throws Exception { Ignite client = startGrid("client", getConfiguration("client").setClientMode(true)); CountDownLatch latch = new CountDownLatch(prestartedSrvcs); latch.await(); assertNotNull(client.services().serviceProxy(name, Service.class, false, 2000)); latch = new CountDownLatch(clients);
/** */ @Test public void testExceptionPropagation() throws Exception { try (IgniteEx srv = startGrid("server")) { try (Ignite client = startGrid("client", getConfiguration("client").setClientMode(true))) { final String srvcName = "my-service"; try { client.services().deployClusterSingleton(srvcName, new ServiceImpl()); fail("Deployment exception has been expected."); } catch (ServiceDeploymentException ex) { String errMsg = ex.getSuppressed()[0].getMessage(); // Check that message contains cause node id assertTrue(errMsg.contains(srv.cluster().localNode().id().toString())); // Check that message contains service name assertTrue(errMsg.contains(srvcName)); Throwable cause = ex.getSuppressed()[0].getCause(); // Check that error's cause contains users message assertTrue(cause.getMessage().contains("ServiceImpl init exception")); } } } }
/** * @param client Client node. * @param svcName Service name. * @throws Exception If failed. */ private void checkDeploy(Ignite client, String svcName) throws Exception { assertTrue(client.configuration().isClientMode()); CountDownLatch latch = new CountDownLatch(1); DummyService.exeLatch(svcName, latch); client.services().deployClusterSingleton(svcName, new DummyService()); assertTrue(latch.await(5000, TimeUnit.MILLISECONDS)); } }
IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setConnectorConfiguration(null); cfg.setIgniteInstanceName(getTestIgniteInstanceName(0)); cfg.setCacheConfiguration(cc); cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName(getTestIgniteInstanceName(1)); cfg.setCacheConfiguration(cc); final CountDownLatch latch = new CountDownLatch(1); assert latch.await(1, SECONDS); g1.cache(DEFAULT_CACHE_NAME).remove(1);
@Override public Object call() throws Exception { barrier.await(); Ignite ignite = startGrid(startIdx.getAndIncrement()); assertTrue(ignite.configuration().isClientMode()); log.info("Started node: " + ignite.name()); return null; } }, 5, "start-thread");
Ignite srv = startGrids(5); IgniteEx client1 = startGrid(getConfiguration("client-1").setClientMode(true)); srv.cluster().active(true); CountDownLatch latch = new CountDownLatch(1); latch.await(5, TimeUnit.SECONDS);
assertTrue(g.configuration().isClientMode()); final UUID nodeId = g.cluster().localNode().id(); final CountDownLatch latch = new CountDownLatch(1); latch.await();
int size = ignite0.configuration().getMarshaller().marshal(msg).length; final CountDownLatch latch = new CountDownLatch(MSG_CNT); ignite0.message().localListen(null, new MessagingListenActor<TestMessage>() { @Override protected void receive(UUID nodeId, TestMessage rcvMsg) throws Throwable { latch.countDown(); ignite1.message().localListen(null, new MessagingListenActor<TestMessage>() { @Override protected void receive(UUID nodeId, TestMessage rcvMsg) throws Throwable { respond(rcvMsg); message(ignite0.cluster().forRemotes()).send(null, msg); latch.await(); ClusterMetrics metrics = ignite0.cluster().localNode().metrics();
return; int idx = nodeIdx.incrementAndGet(); stopGrid(G.allGrids().get(0).configuration().getIgniteInstanceName()); else stopGrid(idx);
@Override public boolean apply() { info("Lock event count: " + lockEvtCnt.get()); if (atomicityMode() == ATOMIC) return lockEvtCnt.get() == 0; if (cacheMode() == PARTITIONED && nearEnabled()) { if (!grid(0).configuration().isClientMode()) return lockEvtCnt.get() == 4; } return lockEvtCnt.get() == 2; } }, 15000));