Class GridClosureProcessor
- java.lang.Object
-
- org.apache.ignite.internal.processors.GridProcessorAdapter
-
- org.apache.ignite.internal.processors.closure.GridClosureProcessor
-
- All Implemented Interfaces:
GridComponent,GridProcessor
public class GridClosureProcessor extends GridProcessorAdapter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridClosureProcessor.C1<T,R>static classGridClosureProcessor.C1MLA<T,R>static classGridClosureProcessor.C2<R>static classGridClosureProcessor.C2MLA<R>static classGridClosureProcessor.C4static classGridClosureProcessor.C4MLA-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
ctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description GridClosureProcessor(GridKernalContext ctx)
-
Method Summary
-
Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onKernalStart, onReconnected, printMemoryStats, stop, toString, validateNode, validateNode
-
-
-
-
Constructor Detail
-
GridClosureProcessor
public GridClosureProcessor(GridKernalContext ctx)
- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
start
public void start() throws IgniteCheckedExceptionStarts grid component.- Specified by:
startin interfaceGridComponent- Overrides:
startin classGridProcessorAdapter- Throws:
IgniteCheckedException- Throws in case of any errors.
-
onKernalStop
public void onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.- Specified by:
onKernalStopin interfaceGridComponent- Overrides:
onKernalStopin classGridProcessorAdapter- Parameters:
cancel- Flag indicating whether jobs should be canceled.
-
runAsync
public ComputeTaskInternalFuture<?> runAsync(GridClosureCallMode mode, Collection<? extends Runnable> jobs, TaskExecutionOptions opts)
- Parameters:
mode- Distribution mode.jobs- Closures to execute.opts- Task execution options.- Returns:
- Task execution future.
-
runAsync
public ComputeTaskInternalFuture<?> runAsync(GridClosureCallMode mode, Runnable job, TaskExecutionOptions opts)
- Parameters:
mode- Distribution mode.job- Closure to execute.opts- Task execution options.- Returns:
- Task execution future.
-
forkjoinAsync
public <R1,R2> ComputeTaskInternalFuture<R2> forkjoinAsync(GridClosureCallMode mode, Collection<? extends Callable<R1>> jobs, IgniteReducer<R1,R2> rdc, TaskExecutionOptions opts)
- Type Parameters:
R1- Type.R2- Type.- Parameters:
mode- Distribution mode.jobs- Closures to execute.rdc- Reducer.opts- Task execution options.- Returns:
- Reduced result.
-
callAsync
public <R> IgniteInternalFuture<Collection<R>> callAsync(GridClosureCallMode mode, Collection<? extends Callable<R>> jobs, TaskExecutionOptions opts)
- Type Parameters:
R- Type.- Parameters:
mode- Distribution mode.jobs- Closures to execute.opts- Task execution options.- Returns:
- Grid future for collection of closure results.
-
affinityCall
public <R> ComputeTaskInternalFuture<R> affinityCall(Collection<String> cacheNames, Object affKey, IgniteCallable<R> job, TaskExecutionOptions opts) throws IgniteCheckedException
- Parameters:
cacheNames- Cache names.affKey- Affinity key.job- Closure to execute.opts- Task execution options.- Returns:
- Grid future for collection of closure results.
- Throws:
IgniteCheckedException- If failed.
-
affinityCall
public <R> ComputeTaskInternalFuture<R> affinityCall(@NotNull @NotNull Collection<String> cacheNames, int partId, Callable<R> job, TaskExecutionOptions opts) throws IgniteCheckedException
- Parameters:
cacheNames- Cache names.partId- Partition.job- Closure to execute.opts- Task execution options.- Returns:
- Grid future for collection of closure results.
- Throws:
IgniteCheckedException- If failed.
-
affinityRun
public ComputeTaskInternalFuture<?> affinityRun(@NotNull @NotNull Collection<String> cacheNames, Object affKey, Runnable job, TaskExecutionOptions opts) throws IgniteCheckedException
- Parameters:
cacheNames- Cache names.affKey- Affinity key.job- Job.opts- Task execution options.- Returns:
- Job future.
- Throws:
IgniteCheckedException- If failed.
-
affinityRun
public ComputeTaskInternalFuture<?> affinityRun(@NotNull @NotNull Collection<String> cacheNames, int partId, Runnable job, TaskExecutionOptions opts) throws IgniteCheckedException
- Parameters:
cacheNames- Cache names.partId- Partition.job- Job.opts- Task execution options.- Returns:
- Job future.
- Throws:
IgniteCheckedException- If failed.
-
callAsync
public <R> IgniteInternalFuture<R> callAsync(GridClosureCallMode mode, Callable<R> job, TaskExecutionOptions opts)
- Type Parameters:
R- Type.- Parameters:
mode- Distribution mode.job- Closure to execute.opts- Task execution options.- Returns:
- Grid future for collection of closure results.
-
callAsync
public <T,R> ComputeTaskInternalFuture<R> callAsync(IgniteClosure<T,R> job, @Nullable T arg, TaskExecutionOptions opts)
- Parameters:
job- Job closure.arg- Optional job argument.opts- Task execution options.- Returns:
- Grid future for execution result.
-
broadcast
public <T,R> IgniteInternalFuture<Collection<R>> broadcast(IgniteClosure<T,R> job, @Nullable T arg, TaskExecutionOptions opts)
- Parameters:
job- Job closure.arg- Optional job argument.opts- Task execution options.- Returns:
- Grid future for execution result.
-
callAsync
public <T,R> ComputeTaskInternalFuture<Collection<R>> callAsync(IgniteClosure<T,R> job, @Nullable @Nullable Collection<? extends T> args, TaskExecutionOptions opts)
- Parameters:
job- Job closure.args- Job arguments.opts- Task execution options.- Returns:
- Grid future for execution result.
-
callAsync
public <T,R1,R2> ComputeTaskInternalFuture<R2> callAsync(IgniteClosure<T,R1> job, Collection<? extends T> args, IgniteReducer<R1,R2> rdc, TaskExecutionOptions opts)
- Parameters:
job- Job closure.args- Job arguments.rdc- Reducer.opts- Task execution options.- Returns:
- Grid future for execution result.
-
runLocalWithThreadPolicy
public void runLocalWithThreadPolicy(IgniteThread thread, Runnable c)
- Parameters:
thread- Thread.c- Closure.
-
runLocal
public IgniteInternalFuture<?> runLocal(@Nullable @Nullable Runnable c, byte plc) throws IgniteCheckedException
- Parameters:
c- Closure to execute.plc- Whether to run on system or public pool.- Returns:
- Future.
- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
runLocalSafe
public IgniteInternalFuture<?> runLocalSafe(Runnable c)
Executes closure on system pool. In case of rejected execution re-runs the closure in the current thread (blocking).- Parameters:
c- Closure to execute.- Returns:
- Future.
-
runLocalSafe
public IgniteInternalFuture<?> runLocalSafe(Runnable c, boolean sys)
In case of rejected execution re-runs the closure in the current thread (blocking).- Parameters:
c- Closure to execute.sys- Iftrue, then system pool will be used, otherwise public pool will be used.- Returns:
- Future.
-
runLocalSafe
public IgniteInternalFuture<?> runLocalSafe(Runnable c, byte plc)
In case of rejected execution re-runs the closure in the current thread (blocking).- Parameters:
c- Closure to execute.plc- Policy to choose executor pool.- Returns:
- Future.
-
callLocal
public <R> IgniteInternalFuture<R> callLocal(@Nullable @Nullable Callable<R> c, byte plc) throws IgniteCheckedException
- Type Parameters:
R- Type of closure return value.- Parameters:
c- Closure to execute.plc- Whether to run on system or public pool.- Returns:
- Future.
- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
callLocalSafe
public <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c)
Executes closure on system pool. Companion tocallLocal(Callable, boolean)but in case of rejected execution re-runs the closure in the current thread (blocking).- Parameters:
c- Closure to execute.- Returns:
- Future.
-
callLocalSafe
public <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c, boolean sys)
Executes closure on system pool. Companion tocallLocal(Callable, boolean)but in case of rejected execution re-runs the closure in the current thread (blocking).- Parameters:
c- Closure to execute.sys- Iftrue, then system pool will be used, otherwise public pool will be used.- Returns:
- Future.
-
callLocalSafe
public <R> IgniteInternalFuture<R> callLocalSafe(Callable<R> c, byte plc)
Companion tocallLocal(Callable, boolean)but in case of rejected execution re-runs the closure in the current thread (blocking).- Parameters:
c- Closure to execute.plc- Policy to choose executor pool.- Returns:
- Future.
-
-