Class GridJobWorker
- java.lang.Object
-
- org.apache.ignite.internal.util.worker.GridWorker
-
- org.apache.ignite.internal.processors.job.GridJobWorker
-
- All Implemented Interfaces:
Runnable,GridTimeoutObject,WorkProgressDispatcher
public class GridJobWorker extends GridWorker implements GridTimeoutObject
Job worker.
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.util.worker.GridWorker
isCancelled
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbody()The implementation should provide the execution body for this runnable.voidcancel()Cancels this runnable.voidcancel(boolean sys)longendTime()voidexecute()Executes the job.StringexecutorName()longgetCreateTime()GridDeploymentgetDeployment()longgetFinishTime()@Nullable ComputeJobgetJob()Gets deployed job ornullof job could not be deployed.ComputeJobContextgetJobContext()IgniteUuidgetJobId()GridReservablegetPartsReservation()GridJobSessionImplgetSession()longgetStartTime()ClusterNodegetTaskNode()inthashCode()booleanheld()booleanhold()Sets halt flags.booleanisFinishing()Gets job finishing state.booleanisInternal()booleanisStarted()booleanisTimedOut()protected voidonCancel(boolean firstCancelRequest)Callback on runner cancellation.protected voidonCancelledBeforeWorkerScheduled()Callback on special case, when task is cancelled before is has been scheduled.voidonStopping()Callback for whenever grid is stopping.voidonTimeout()Timeout callback.IgniteUuidtimeoutId()StringtoString()-
Methods inherited from class org.apache.ignite.internal.util.worker.GridWorker
blockingSectionBegin, blockingSectionEnd, cleanup, heartbeatTs, igniteInstanceName, isCancelled, isDone, join, name, onIdle, run, runner, updateHeartbeat
-
-
-
-
Method Detail
-
getJob
@Nullable public @Nullable ComputeJob getJob()
Gets deployed job ornullof job could not be deployed.- Returns:
- Deployed job.
-
getDeployment
public GridDeployment getDeployment()
- Returns:
- Deployed task.
-
getCreateTime
public long getCreateTime()
- Returns:
- Create time.
-
getStartTime
public long getStartTime()
- Returns:
- Start time.
-
getFinishTime
public long getFinishTime()
- Returns:
- Finish time.
-
isStarted
public boolean isStarted()
- Returns:
- Is started.
-
getPartsReservation
public GridReservable getPartsReservation()
- Returns:
- Grid reservable resource.
-
getJobId
public IgniteUuid getJobId()
- Returns:
- Unique job ID.
-
getJobContext
public ComputeJobContext getJobContext()
- Returns:
- Job context.
-
getSession
public GridJobSessionImpl getSession()
- Returns:
- Session.
-
isFinishing
public boolean isFinishing()
Gets job finishing state.- Returns:
trueif job is being finished after execution andfalseotherwise.
-
getTaskNode
public ClusterNode getTaskNode()
- Returns:
- Parent task node ID.
-
endTime
public long endTime()
- Specified by:
endTimein interfaceGridTimeoutObject- Returns:
- End time.
-
timeoutId
public IgniteUuid timeoutId()
- Specified by:
timeoutIdin interfaceGridTimeoutObject- Returns:
- ID of the object.
-
isTimedOut
public boolean isTimedOut()
- Returns:
Trueif job is timed out.
-
isInternal
public boolean isInternal()
- Returns:
Trueif parent task is internal or Visor-related.
-
onTimeout
public void onTimeout()
Timeout callback.- Specified by:
onTimeoutin interfaceGridTimeoutObject
-
onStopping
public void onStopping()
Callback for whenever grid is stopping.
-
held
public boolean held()
- Returns:
Trueif job was halted.
-
hold
public boolean hold()
Sets halt flags.
-
body
protected void body()
The implementation should provide the execution body for this runnable.- Specified by:
bodyin classGridWorker
-
execute
public void execute()
Executes the job.
-
cancel
public void cancel()
Cancels this runnable.- Overrides:
cancelin classGridWorker
-
cancel
public void cancel(boolean sys)
- Parameters:
sys- System flag.
-
executorName
public String executorName()
- Returns:
- Custom executor name.
-
onCancel
protected void onCancel(boolean firstCancelRequest)
Callback on runner cancellation.- Overrides:
onCancelin classGridWorker- Parameters:
firstCancelRequest- Flag indicating that worker cancellation was requested for the first time.
-
onCancelledBeforeWorkerScheduled
protected void onCancelledBeforeWorkerScheduled()
Callback on special case, when task is cancelled before is has been scheduled.- Overrides:
onCancelledBeforeWorkerScheduledin classGridWorker
-
toString
public String toString()
- Overrides:
toStringin classGridWorker
-
-