public class GridTaskProcessor extends GridProcessorAdapter implements IgniteChangeGlobalStateSupport
GridComponent.DiscoveryDataExchangeType
Modifier and Type | Field and Description |
---|---|
static String |
TASKS_VIEW |
static String |
TASKS_VIEW_DESC |
static String |
TOTAL_EXEC_TASKS
Total executed tasks metric name.
|
ctx, diagnosticLog, log
Constructor and Description |
---|
GridTaskProcessor(GridKernalContext ctx) |
Modifier and Type | Method and Description |
---|---|
<T,R> ComputeTaskInternalFuture<R> |
execute(Class<? extends ComputeTask<T,R>> taskCls,
T arg) |
<T,R> ComputeTaskInternalFuture<R> |
execute(Class<? extends ComputeTask<T,R>> taskCls,
T arg,
@Nullable String execName) |
<T,R> ComputeTaskInternalFuture<R> |
execute(ComputeTask<T,R> task,
T arg) |
<T,R> ComputeTaskInternalFuture<R> |
execute(ComputeTask<T,R> task,
T arg,
boolean sys) |
<T,R> ComputeTaskInternalFuture<R> |
execute(ComputeTask<T,R> task,
T arg,
boolean sys,
@Nullable String execName) |
<T,R> ComputeTaskInternalFuture<R> |
execute(ComputeTask<T,R> task,
T arg,
String execName) |
<T,R> ComputeTaskInternalFuture<R> |
execute(String taskName,
T arg) |
<T,R> ComputeTaskInternalFuture<R> |
execute(String taskName,
T arg,
@Nullable String execName) |
<T> T |
getThreadContext(GridTaskThreadContextKey key)
Gets thread-local context value for a given
key . |
Map<String,GridDeployment> |
getUsedDeploymentMap()
Gets currently used deployments mapped by task name or aliases.
|
Collection<GridDeployment> |
getUsedDeployments()
Gets currently used deployments.
|
void |
onActivate(GridKernalContext kctx)
Called when cluster performing activation.
|
void |
onCancelled(IgniteUuid sesId)
Handles user cancellation.
|
void |
onDeActivate(GridKernalContext kctx)
Called when cluster performing deactivation.
|
void |
onDisconnected(IgniteFuture<?> reconnectFut)
Client disconnected callback.
|
void |
onKernalStart(boolean active)
Callback that notifies that kernal has successfully started,
including all managers and processors.
|
void |
onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.
|
void |
printMemoryStats()
Prints memory statistics (sizes of internal structures, etc.).
|
void |
processJobExecuteResponse(UUID nodeId,
GridJobExecuteResponse msg) |
void |
resetMetrics()
Resets processor metrics.
|
String |
resolveTaskName(int taskNameHash)
Resolves task name by task name hash.
|
void |
setAttributes(GridTaskSessionImpl ses,
Map<?,?> attrs) |
void |
setThreadContext(GridTaskThreadContextKey key,
Object val)
Sets the thread-local context value.
|
void |
setThreadContextIfNotNull(GridTaskThreadContextKey key,
@Nullable Object val)
Sets the thread-local context value, if it is not null.
|
void |
start()
Starts grid component.
|
void |
stop(boolean cancel)
Stops grid component.
|
<R> @Nullable ComputeTaskInternalFuture<R> |
taskFuture(IgniteUuid sesId) |
<R> Map<IgniteUuid,ComputeTaskFuture<R>> |
taskFutures() |
assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, onGridDataReceived, onJoiningNodeDataReceived, onReconnected, toString, validateNode, validateNode
public static final String TASKS_VIEW
public static final String TASKS_VIEW_DESC
public static final String TOTAL_EXEC_TASKS
public GridTaskProcessor(GridKernalContext ctx)
ctx
- Kernal context.public void start()
start
in interface GridComponent
start
in class GridProcessorAdapter
public void onKernalStart(boolean active) throws IgniteCheckedException
onKernalStart
in interface GridComponent
onKernalStart
in class GridProcessorAdapter
active
- Cluster active flag (note: should be used carefully since state can
change concurrently).IgniteCheckedException
- Thrown in case of any errors.public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException
onDisconnected
in interface GridComponent
onDisconnected
in class GridProcessorAdapter
reconnectFut
- Reconnect future.IgniteCheckedException
- If failed.public void onKernalStop(boolean cancel)
onKernalStop
in interface GridComponent
onKernalStop
in class GridProcessorAdapter
cancel
- Flag indicating whether jobs should be canceled.public void stop(boolean cancel)
stop
in interface GridComponent
stop
in class GridProcessorAdapter
cancel
- If true
, then all ongoing tasks or jobs for relevant
components need to be cancelled.public void setThreadContext(GridTaskThreadContextKey key, Object val)
key
- Key.val
- Value.public void setThreadContextIfNotNull(GridTaskThreadContextKey key, @Nullable @Nullable Object val)
key
- Key.val
- Value.@Nullable public <T> T getThreadContext(GridTaskThreadContextKey key)
key
.key
- Thread-local context key.key
- or null
if value with given key
doesn't exist.public Collection<GridDeployment> getUsedDeployments()
public Map<String,GridDeployment> getUsedDeploymentMap()
public <T,R> ComputeTaskInternalFuture<R> execute(Class<? extends ComputeTask<T,R>> taskCls, @Nullable T arg)
T
- Task argument type.R
- Task return value type.taskCls
- Task class.arg
- Optional execution argument.public <T,R> ComputeTaskInternalFuture<R> execute(Class<? extends ComputeTask<T,R>> taskCls, @Nullable T arg, @Nullable @Nullable String execName)
T
- Task argument type.R
- Task return value type.taskCls
- Task class.arg
- Optional execution argument.execName
- Name of the custom executor.public <T,R> ComputeTaskInternalFuture<R> execute(ComputeTask<T,R> task, @Nullable T arg)
T
- Task argument type.R
- Task return value type.task
- Actual task.arg
- Optional task argument.public <T,R> ComputeTaskInternalFuture<R> execute(ComputeTask<T,R> task, @Nullable T arg, String execName)
T
- Task argument type.R
- Task return value type.task
- Actual task.arg
- Optional task argument.execName
- Name of the custom executor.public <T,R> ComputeTaskInternalFuture<R> execute(ComputeTask<T,R> task, @Nullable T arg, boolean sys)
T
- Task argument type.R
- Task return value type.task
- Actual task.arg
- Optional task argument.sys
- If true
, then system pool will be used.public <T,R> ComputeTaskInternalFuture<R> execute(ComputeTask<T,R> task, @Nullable T arg, boolean sys, @Nullable @Nullable String execName)
T
- Task argument type.R
- Task return value type.task
- Actual task.arg
- Optional task argument.sys
- If true
, then system pool will be used.execName
- Name of the custom executor.public String resolveTaskName(int taskNameHash)
taskNameHash
- Task name hash.null
if not found.public <T,R> ComputeTaskInternalFuture<R> execute(String taskName, @Nullable T arg)
T
- Task argument type.R
- Task return value type.taskName
- Task name.arg
- Optional execution argument.public <T,R> ComputeTaskInternalFuture<R> execute(String taskName, @Nullable T arg, @Nullable @Nullable String execName)
T
- Task argument type.R
- Task return value type.taskName
- Task name.arg
- Optional execution argument.execName
- Name of the custom executor.@Nullable public <R> @Nullable ComputeTaskInternalFuture<R> taskFuture(IgniteUuid sesId)
sesId
- Task's session id.ComputeTaskInternalFuture
instance or null
if no such task found.public <R> Map<IgniteUuid,ComputeTaskFuture<R>> taskFutures()
public void setAttributes(GridTaskSessionImpl ses, Map<?,?> attrs) throws IgniteCheckedException
ses
- Task session.attrs
- Attributes.IgniteCheckedException
- Thrown in case of any errors.public void processJobExecuteResponse(UUID nodeId, GridJobExecuteResponse msg)
nodeId
- Node ID.msg
- Execute response message.public void onCancelled(IgniteUuid sesId)
sesId
- Session ID.public void onActivate(GridKernalContext kctx) throws IgniteCheckedException
onActivate
in interface IgniteChangeGlobalStateSupport
kctx
- Kernal context.IgniteCheckedException
- If failed.public void onDeActivate(GridKernalContext kctx)
onDeActivate
in interface IgniteChangeGlobalStateSupport
kctx
- Kernal context.public void resetMetrics()
public void printMemoryStats()
printMemoryStats
in interface GridComponent
printMemoryStats
in class GridProcessorAdapter
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021