@Override public Void call() throws Exception { latch.await(); Ignite g = startGrid("client-" + clientIdx.getAndIncrement()); clientNodeIds.add(g.cluster().localNode().id()); return null; } }, CLIENTS, "start-client");
@Override public boolean apply(ClusterNode node, Message msg) { if (msg instanceof GridNearTxFinishRequest) { GridNearTxFinishRequest r = (GridNearTxFinishRequest)msg; return r.commit() && node.equals(prim.cluster().localNode()); } return false; } });
/** {@inheritDoc} */ @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, UUID arg) { assert subgrid.size() == 2; assert taskSes != null; assert ignite != null; assert ignite.cluster().localNode().id().equals(arg); taskSes.saveCheckpoint("test", arg); // Always map job to the local node where it will fail. return Collections.singletonMap(new GridTestMultipleSpisJob(arg), ignite.cluster().localNode()); }
/** {@inheritDoc} */ @Override public boolean apply(CacheEvent evt) { Affinity<Object> affinity = ignite.affinity(cacheName); if (affinity.isPrimary(ignite.cluster().localNode(), evt.key())) { // Process this event. Ignored on backups. if (filter != null && filter.apply(evt)) return false; return true; } return false; } }
@Override public void run() { try { Ignite g3 = startGrid(3); info(">>> Started grid g3: " + g3.cluster().localNode().id()); } catch (Exception e) { info(">>> Failed to start 4th node: " + e); } } }, 1);
/** {@inheritDoc} */ @Override public TestClass1 call() throws Exception { assertFalse("true".equals(ignite.cluster().localNode().attribute(ATTR_DAEMON))); return new TestClass1(111); } }
/** {@inheritDoc} */ @Override public TestClass2 call() throws Exception { assertFalse("true".equals(ignite.cluster().localNode().attribute(ATTR_DAEMON))); return new TestClass2(222); } }
@Override public boolean apply() { // Partition count which must be transferred to 2'nd node. int parts = ignite2.affinity(DEFAULT_CACHE_NAME).allPartitions(ignite2.cluster().localNode()).length; return evtCnt.get() >= parts; } }, 5000);
/** {@inheritDoc} */ @Override public boolean apply(UUID uuid, Event evt) { assertTrue(ignite.cluster().localNode().isClient()); ignite.log().info("Received event: " + evt); if (latch != null) latch.countDown(); return true; } }
/** {@inheritDoc} */ @Override public Integer call() throws IgniteCheckedException { assertNotNull(ignite); ignite.log().info("Running job [node=" + ignite.cluster().localNode().id() + ", job=" + this + "]"); IgniteQueue<Integer> queue = ignite.queue(queueName, 0, null); assertNotNull(queue); Collection<Integer> items = new ArrayList<>(); for (int i = 0; i < size; i++) items.add(cntr.getAndIncrement()); queue.addAll(items); return queue.size(); }
/** * @throws Exception If failed. */ @Test public void testGetLocalNode() throws Exception { ClusterNode node = ignite.cluster().localNode(); assert node != null; Collection<ClusterNode> nodes = ignite.cluster().nodes(); assert nodes != null; assert nodes.contains(node); }
/** * @param assign Assignments. * @param cacheName Cache name. * @param expState Expected state. */ private void checkPartitionsState(AffinityAssignment assign, String cacheName, GridDhtPartitionState expState) { for (Ignite node : G.allGrids()) checkNodePartitions(assign, node.cluster().localNode(), cacheName, expState); }
/** {@inheritDoc} */ @Override public Integer call() throws IgniteCheckedException { assertNotNull(ignite); ignite.log().info("Running job [node=" + ignite.cluster().localNode().id() + ", job=" + this + "]"); retries(ignite, true); return 0; }
/** {@inheritDoc} */ @Override public Integer call() throws IgniteCheckedException { assertNotNull(ignite); ignite.log().info("Running job [node=" + ignite.cluster().localNode().id() + ", job=" + this + "]"); retries(ignite, false); return 0; }
/** {@inheritDoc} */ @Override public Integer call() throws IgniteCheckedException { assertNotNull(ignite); ignite.log().info("Running job [node=" + ignite.cluster().localNode().id() + ", job=" + this + "]"); removeRetriesSimple(ignite, true); return 0; }
/** * @param g Grid. * @param tm Transaction manager. */ private void checkTm(Ignite g, IgniteTxManager tm) { Collection<IgniteInternalTx> txs = tm.activeTransactions(); info(">>> Number of transactions in the set [size=" + txs.size() + ", nodeId=" + g.cluster().localNode().id() + ']'); for (IgniteInternalTx tx : txs) assert tx.done() : "Transaction is not finished: " + tx; } }
/** {@inheritDoc} */ @Override public Integer call() throws IgniteCheckedException { assertNotNull(ignite); ignite.log().info("Running job [node=" + ignite.cluster().localNode().id() + ", job=" + this + ']'); IgniteQueue<Integer> queue = ignite.queue(queueName, 0, null); assertNotNull(queue); for (int i = 0; i < retries; i++) { queue.put(i); assertNotNull(queue.take()); } return queue.size(); }
/** {@inheritDoc} */ @Override public void cancel(ServiceContext ctx) { locNode.log().info("Service cancelled [execId=" + ctx.executionId() + ", node=" + locNode.cluster().localNode() + ']'); }
@Override public void run() { doSleep(1000); //spi1.failSend = false; cnt.getAndAdd(c1.compute(c1.cluster().forNodeId(c2.cluster().localNode().id())).call(new TestClosure())); } }, 1, "hang-thread");
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); Ignite client = ignite(gridCount() - 1); assertTrue(client.cluster().localNode().isClient()); for (CacheConfiguration<Integer, Integer> ccfg : cacheConfigurations()) { grid(0).createCache(ccfg); client.createNearCache(ccfg.getName(), new NearCacheConfiguration<>()); } awaitPartitionMapExchange(); }