use of org.apache.ignite.IgniteCompute in project ignite by apache.
the class IgniteComputeResultExceptionTest method checkExecuteAsyncException.
/**
*/
private void checkExecuteAsyncException(IgniteException resE) throws Exception {
try (Ignite ignite = startGrid()) {
IgniteCompute compute = ignite.compute();
ComputeTaskFuture<Object> fut = compute.executeAsync(new ResultExceptionTask(resE), null);
try {
fut.get();
} catch (IgniteException e) {
assertSame(resE, e);
}
}
}
use of org.apache.ignite.IgniteCompute in project ignite by apache.
the class GridTaskExecutionSelfTest method testJobIdCollision.
/**
* Test for https://issues.apache.org/jira/browse/IGNITE-1384
*
* @throws Exception If failed.
*/
@Test
public void testJobIdCollision() throws Exception {
fail("Test refactoring is needed: https://issues.apache.org/jira/browse/IGNITE-4706");
long locId = IgniteUuid.lastLocalId();
ArrayList<IgniteFuture<Object>> futs = new ArrayList<>(2016);
IgniteCompute compute = grid(1).compute(grid(1).cluster().forNodeId(grid(3).localNode().id()));
for (int i = 0; i < 1000; i++) {
futs.add(compute.callAsync(new IgniteCallable<Object>() {
@JobContextResource
ComputeJobContext ctx;
boolean held;
@Override
public Object call() throws Exception {
if (!held) {
ctx.holdcc(1000);
held = true;
}
return null;
}
}));
}
info("Finished first loop.");
AtomicLong idx = U.field(IgniteUuid.class, "cntGen");
idx.set(locId);
IgniteCompute compute1 = grid(2).compute(grid(2).cluster().forNodeId(grid(3).localNode().id()));
for (int i = 0; i < 100; i++) {
futs.add(compute1.callAsync(new IgniteCallable<Object>() {
@JobContextResource
ComputeJobContext ctx;
boolean held;
@Override
public Object call() throws Exception {
if (!held) {
ctx.holdcc(1000);
held = true;
}
return null;
}
}));
}
for (IgniteFuture<Object> fut : futs) fut.get();
}
use of org.apache.ignite.IgniteCompute in project ignite by apache.
the class IgniteCacheRandomOperationBenchmark method doScanQuery.
/**
* @param cache Ignite cache.
* @throws Exception If failed.
*/
private void doScanQuery(IgniteCache<Object, Object> cache) throws Exception {
if (!affCaches.contains(cache))
return;
Map<UUID, List<Integer>> partitionsMap = personCachePartitions(cache.getName());
ScanQueryBroadcastClosure c = new ScanQueryBroadcastClosure(cache.getName(), partitionsMap);
ClusterGroup clusterGrp = ignite().cluster().forNodeIds(partitionsMap.keySet());
IgniteCompute compute = ignite().compute(clusterGrp);
compute.broadcast(c);
}
Aggregations