本文整理了Java中org.apache.ignite.Ignite.executorService()
方法的一些代码示例,展示了Ignite.executorService()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.executorService()
方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:executorService
[英]Creates a new ExecutorService which will execute all submitted Callable and Runnable jobs on all cluster nodes. This essentially creates a Distributed Thread Pool that can be used as a replacement for local thread pools.
[中]创建一个新的ExecutorService,它将在所有群集节点上执行所有提交的可调用和可运行作业。这实质上创建了一个分布式线程池,可以用来替换本地线程池。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public ExecutorService executorService() {
checkIgnite();
return g.executorService();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public ExecutorService executorService(ClusterGroup grp) {
checkIgnite();
return g.executorService(grp);
}
代码示例来源:origin: apache/ignite
/**
* @param ignite Grid instance.
* @return Thrown in case of test failure.
*/
private ExecutorService createExecutorService(Ignite ignite) {
assert ignite != null;
return ignite.executorService();
}
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
boolean failed = false;
try {
client.executorService().submit(new Callable<Integer>() {
@Override public Integer call() throws Exception {
return 42;
}
});
}
catch (IgniteClientDisconnectedException e) {
failed = true;
checkAndWait(e);
}
assertTrue(failed);
return client.executorService().submit(new Callable<Integer>() {
@Override public Integer call() throws Exception {
return 42;
}
});
}
},
代码示例来源:origin: apache/ignite
/**
* @param cnt Counter.
* @throws Exception If failed.
*/
private void executorService(AtomicInteger cnt) throws Exception {
cnt.set(0);
ExecutorService execSrvc = prj.ignite().executorService(prj);
Future<String> fut = execSrvc.submit(new TestCallable<String>() {
@Override public String call() throws Exception {
return "submit1";
}
});
waitForValue(cnt, 1);
assertEquals("submit1", fut.get());
cnt.set(0);
fut = execSrvc.submit(new TestRunnable(), "submit2");
waitForValue(cnt, 1);
assertEquals("submit2", fut.get());
cnt.set(0);
Future<?> runFut = execSrvc.submit(new TestRunnable());
waitForValue(cnt, 1);
runFut.get();
}
代码示例来源:origin: apache/ignite
Ignite srv1 = startGrid(0);
Ignite srv2 = startGrid(1);
ExecutorService exec1 = srv1.executorService();
ExecutorService exec2 = srv2.executorService();
代码示例来源:origin: apache/ignite
ignite0.executorService(ignite0.cluster().forLocal()).submit(new Runnable() {
@Override public void run() {
addIntField(ignite0, "f1", 101, 1);
ignite1.executorService(ignite1.cluster().forLocal()).submit(new Runnable() {
@Override public void run() {
addStringField(ignite1, "f2", "str", 2);
代码示例来源:origin: apache/ignite
/**
* Verifies that client resends request for up-to-date metadata in case of failure on server received first request.
*/
@Test
public void testClientRequestsUpToDateMetadataOneNodeDies() throws Exception {
final Ignite srv0 = startGrid(0);
replaceWithStoppingMappingRequestListener(((GridKernalContext)U.field(srv0, "ctx")).io(), 0);
final Ignite srv1 = startGrid(1);
replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv1, "ctx")).io());
final Ignite srv2 = startGrid(2);
replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv2, "ctx")).io());
final Ignite client = startDeafClient("client");
ClusterGroup clientGrp = client.cluster().forClients();
srv0.executorService().submit(new Runnable() {
@Override public void run() {
addStringField(srv0, "f2", "strVal101", 0);
}
}).get();
client.compute(clientGrp).call(new IgniteCallable<String>() {
@Override public String call() throws Exception {
return ((BinaryObject)client.cache(DEFAULT_CACHE_NAME).withKeepBinary().get(0)).field("f2");
}
});
assertEquals(metadataReqsCounter.get(), 2);
}
代码示例来源:origin: org.apache.ignite/ignite-spring
/** {@inheritDoc} */
@Override public ExecutorService executorService() {
checkIgnite();
return g.executorService();
}
代码示例来源:origin: org.apache.ignite/ignite-spring
/** {@inheritDoc} */
@Override public ExecutorService executorService(ClusterGroup grp) {
checkIgnite();
return g.executorService(grp);
}
内容来源于网络,如有侵权,请联系作者删除!