public class GridExecutorService extends Object implements ExecutorService, Externalizable
ExecutorService that executes each submitted task in grid
through Ignite instance, normally configured using
Ignite.executorService() method.
GridExecutorService delegates commands execution to already
started Ignite instance. Every submitted task will be serialized and
transferred to any node in grid.
All submitted tasks must implement Serializable interface.
Note, that GridExecutorService implements ExecutorService from JDK 1.5. If you have problems with compilation for JDK 1.6 and above you need to apply some changes (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6267833)
Change signature for methods invokeAll(Collection),
invokeAll(Collection, long, TimeUnit),
invokeAny(Collection),
invokeAny(Collection, long, TimeUnit) to
public class GridExecutorService implements ExecutorService {
...
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
...
}
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException {
...
}
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
...
}
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
}
...
}
| Constructor and Description |
|---|
GridExecutorService()
No-arg constructor is required by externalization.
|
GridExecutorService(ClusterGroupAdapter prj,
GridKernalContext ctx)
Creates executor service.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
execute(Runnable cmd) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks)
Note, for compilation with JDK 1.6 necessary to change method signature
(note the {@code <?
|
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
Note, for compilation with JDK 1.6 necessary to change method signature
(note the {@code <?
|
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks)
Note, for compilation with JDK 1.6 necessary to change method signature
(note the {@code <?
|
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)
Note, for compilation with JDK 1.6 necessary to change method signature
(note the {@code <?
|
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T res) |
void |
writeExternal(ObjectOutput out) |
public GridExecutorService()
public GridExecutorService(ClusterGroupAdapter prj, GridKernalContext ctx)
prj - Projection.ctx - Grid logger.public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionprotected Object readResolve() throws ObjectStreamException
ObjectStreamException - Thrown in case of unmarshalling error.public void shutdown()
shutdown in interface ExecutorServicepublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic <T> Future<T> submit(Callable<T> task)
submit in interface ExecutorServicepublic <T> Future<T> submit(Runnable task, T res)
submit in interface ExecutorServicepublic Future<?> submit(Runnable task)
submit in interface ExecutorServicepublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
Note, for compilation with JDK 1.6 necessary to change method signature
(note the <? extends T> clause).
...
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
// Method body.
}
...
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
Note, for compilation with JDK 1.6 necessary to change method signature
(note the <? extends T> clause).
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException {
...
}
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
Note, for compilation with JDK 1.6 necessary to change method signature
(note the <? extends T> clause).
...
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
// Method body.
}
...
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
Note, for compilation with JDK 1.6 necessary to change method signature
(note the <? extends T> clause).
...
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
}
...
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionTimeoutException
Follow @ApacheIgnite
Ignite Fabric : ver. 2.5.0 Release Date : May 23 2018