/** * @param ignite Grid. * @return {@link org.apache.ignite.IgniteCompute} for given grid's local node. */ protected IgniteCompute forLocal(Ignite ignite) { return ignite.compute(ignite.cluster().forLocal()); }
/** * @return Node UUID as string. */ String getUID() { String id = ""; Collection<ClusterNode> nodes = igniteInstance.cluster().forLocal().nodes(); for (ClusterNode node : nodes) { if (node.isLocal()) id = String.valueOf(node.id()); } return id; }
/** * Starts computation job. * * @param idx Grid index on which computation job should start. * @param restartIdx The index of the node to be restarted. * @param workersCntr The current number of computation threads. */ private void startComputation(int idx, AtomicInteger restartIdx, AtomicInteger workersCntr) { Ignite ignite = grid(idx); ClusterGroup cg = ignite.cluster().forLocal(); ignite.compute(cg).callAsync(new BinaryObjectAdder(startLatch, idx, updatesQueue, restartIdx, workersCntr)); }
/** * @throws Exception If fail. */ private void orderedMessage() throws Exception { Ignite ignite = grid(SERVER_NODE_IDX); ClusterGroup grp = gridCount() > 1 ? ignite.cluster().forRemotes() : ignite.cluster().forLocal(); assert !grp.nodes().isEmpty(); registerListenerAndSendOrderedMessages(ignite, grp); }
/** * @throws Exception If test failed. */ @Test public void testContinuousJobSiblingsLocalNode() throws Exception { try { Ignite ignite = startGrid(0); compute(ignite.cluster().forLocal()).execute(TestTask.class, null); } finally { stopAllGrids(); } }
/** * * @throws Exception If fail. */ private void collectionMessage() throws Exception { Ignite ignite = grid(SERVER_NODE_IDX); ClusterGroup grp = gridCount() > 1 ? ignite.cluster().forRemotes() : ignite.cluster().forLocal(); assert !grp.nodes().isEmpty(); int messages = MSGS; LATCH = new CountDownLatch(grp.nodes().size() * messages); UUID opId = ignite.message(grp).remoteListen(MESSAGE_TOPIC, new MessageListener()); try { List<Object> msgs = new ArrayList<>(); for (int i = 0; i < messages; i++) msgs.add(value(i)); ignite.message(grp).send(MESSAGE_TOPIC, msgs); assertTrue(LATCH.await(10, TimeUnit.SECONDS)); } finally { ignite.message().stopRemoteListen(opId); } }
Long res = compute(ignite.cluster().forLocal()).call(closures, new R1<Long, Long>() { private long sum;
IgniteFuture<Long> fut = compute(ignite.cluster().forLocal()).callAsync(closures, new R1<Long, Long>() { private long sum;
message(ignite2.cluster().forLocal()).send(null, MSG_3);
ClusterGroup rNode1 = ignite1.cluster().forLocal();
ClusterGroup rNode1 = ignite1.cluster().forLocal();
Collection<Integer> locQueueContent = compute(newIgnite.cluster().forLocal()).call( new IgniteCallable<Collection<Integer>>() { @IgniteInstanceResource
ClusterGroup prj = ignite.cluster().forLocal();
/** * @throws Exception If failed. */ @Test public void testNodeSingletonProxy() throws Exception { String name = "testNodeSingletonProxy"; Ignite ignite = randomGrid(); ignite.services().deployNodeSingleton(name, new CounterServiceImpl()); CounterService svc = ignite.services().serviceProxy(name, CounterService.class, false); for (int i = 0; i < 10; i++) svc.increment(); assertEquals(10, svc.get()); assertEquals(10, svc.localIncrements()); assertEquals(10, ignite.services(ignite.cluster().forLocal()). serviceProxy(name, CounterService.class, false).localIncrements()); // Make sure that remote proxies were not called. for (ClusterNode n : ignite.cluster().forRemotes().nodes()) { CounterService rmtSvc = ignite.services(ignite.cluster().forNode(n)).serviceProxy(name, CounterService.class, false); assertEquals(0, rmtSvc.localIncrements()); } }
@Override public ClusterGroup getClusterGroup(Ignite ignite) { return ignite.cluster().forLocal(); } };