Java Code Examples for org.apache.ignite.Ignite#compute()
The following examples show how to use
org.apache.ignite.Ignite#compute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HibernateL2CacheMultiJvmTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testL2Cache() throws Exception { Ignite srv = ignite(0); { IgniteCompute client1Compute = srv.compute(srv.cluster().forNodeId(ignite(1).cluster().localNode().id())); client1Compute.run(new HibernateInsertRunnable()); } { IgniteCompute client2Compute = srv.compute(srv.cluster().forNodeId(ignite(2).cluster().localNode().id())); client2Compute.run(new HibernateLoadRunnable()); } { IgniteCompute srvCompute = srv.compute(srv.cluster().forLocal()); srvCompute.run(new HibernateLoadRunnable()); } }
Example 2
Source File: HibernateL2CacheMultiJvmTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testL2Cache() throws Exception { Ignite srv = ignite(0); { IgniteCompute client1Compute = srv.compute(srv.cluster().forNodeId(ignite(1).cluster().localNode().id())); client1Compute.run(new HibernateInsertRunnable()); } { IgniteCompute client2Compute = srv.compute(srv.cluster().forNodeId(ignite(2).cluster().localNode().id())); client2Compute.run(new HibernateLoadRunnable()); } { IgniteCompute srvCompute = srv.compute(srv.cluster().forLocal()); srvCompute.run(new HibernateLoadRunnable()); } }
Example 3
Source File: HibernateL2CacheMultiJvmTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testL2Cache() throws Exception { Ignite srv = ignite(0); { IgniteCompute client1Compute = srv.compute(srv.cluster().forNodeId(ignite(1).cluster().localNode().id())); client1Compute.run(new HibernateInsertRunnable()); } { IgniteCompute client2Compute = srv.compute(srv.cluster().forNodeId(ignite(2).cluster().localNode().id())); client2Compute.run(new HibernateLoadRunnable()); } { IgniteCompute srvCompute = srv.compute(srv.cluster().forLocal()); srvCompute.run(new HibernateLoadRunnable()); } }
Example 4
Source File: IgniteClientReconnectFailoverTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testReconnectComputeApi() throws Exception { final Ignite client = grid(serverCount()); final IgniteCompute comp = client.compute(); reconnectFailover(new Callable<Void>() { @Override public Void call() throws Exception { comp.call(new DummyClosure()); comp.broadcast(new DummyClosure()); return null; } }); }
Example 5
Source File: IgniteProcessProxy.java From ignite with Apache License 2.0 | 5 votes |
/** * @return {@link IgniteCompute} instance to communicate with remote node. */ public IgniteCompute remoteCompute() { Ignite localJvmGrid = localJvmGrid(); if (localJvmGrid == null) return null; ClusterGroup grp = localJvmGrid.cluster().forNodeId(id); if (grp.nodes().isEmpty()) throw new IllegalStateException("Could not found node with id=" + id + "."); return localJvmGrid.compute(grp); }
Example 6
Source File: TcpCommunicationSpiSkipMessageSendTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @throws Exception If failed. */ @Test public void testClientSegmented() throws Exception { startGrid("server"); Ignite client = startClientGrid("client"); CountDownLatch clientDisconnected = new CountDownLatch(1); CountDownLatch clientSegmented = new CountDownLatch(1); IgnitePredicate<Event> locLsnr = new IgnitePredicate<Event>() { @Override public boolean apply(Event evt) { log.info("Client node received event: " + evt.name()); if (evt.type() == EventType.EVT_CLIENT_NODE_DISCONNECTED) clientDisconnected.countDown(); if (evt.type() == EventType.EVT_NODE_SEGMENTED) clientSegmented.countDown(); return true; } }; client.events().localListen(locLsnr, EventType.EVT_NODE_SEGMENTED, EventType.EVT_CLIENT_NODE_DISCONNECTED); IgniteCompute compute = client.compute(); runJobAsync(compute); if (!COMPUTE_JOB_STARTED.await(START_JOB_TIMEOUT, TimeUnit.MILLISECONDS)) fail("Compute job wasn't started."); disableNetwork(client); if (!clientDisconnected.await(JOIN_TIMEOUT * 2, TimeUnit.MILLISECONDS)) fail("Client wasn't disconnected."); if (!clientSegmented.await(JOIN_TIMEOUT * 2, TimeUnit.MILLISECONDS)) fail("Client wasn't segmented."); }
Example 7
Source File: DistributedClosureRemoteSecurityContextCheckTest.java From ignite with Apache License 2.0 | 4 votes |
/** */ private IgniteCompute compute(UUID id) { Ignite loc = localIgnite(); return loc.compute(loc.cluster().forNodeId(id)); }
Example 8
Source File: AbstractRemoteSecurityContextCheckTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @return IgniteCompute is produced by passed node for cluster group that contains nodes with ids from collection. */ protected static IgniteCompute compute(Ignite ignite, Collection<UUID> ids) { return ignite.compute(ignite.cluster().forNodeIds(ids)); }
Example 9
Source File: AccessToClassesInsideInternalPackageTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @return IgniteCompute with the filter that allows SRV node only. */ private IgniteCompute compute(Ignite node) { return node.compute(node.cluster().forNodeId(grid(SRV).localNode().id())); }
Example 10
Source File: DoPrivilegedOnRemoteNodeTest.java From ignite with Apache License 2.0 | 4 votes |
/** */ private IgniteCompute clientCompute() { Ignite clnt = grid(CLNT_NODE); return clnt.compute(clnt.cluster().forRemotes()); }
Example 11
Source File: IgniteOperationsInsideSandboxTest.java From ignite with Apache License 2.0 | 4 votes |
/** */ private IgniteCompute compute() { Ignite clnt = grid(CLNT_ALLOWED_WRITE_PROP); return clnt.compute(clnt.cluster().forRemotes()); }
Example 12
Source File: GridCommonAbstractTest.java From ignite with Apache License 2.0 | 2 votes |
/** * @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()); }