IJob
A job is a target that implements this interface. This is usually not done by yourself: there is an abstract class CAbstractJob, which takes over this task. You can then focus on implementing your task. The work starts with registering your job target in the target registry, and ends with deregistering from the target registry. The entry point is the message handler for the message CRecordStartTarget, which is the first message that the target receives from the system, see "How to start a simple target".
Getter
Each job has a random UUID as ID to identify the job for sure.
@NotNull UUID getId();
Each job has a status. At the beginning this status is set to EJobStatus.DETACHED.
@NotNull EJobStatus getStatus();
Returns the target of the job.
ITarget getTarget();
Get the address of the target.
CTargetAddress getAddress();
Determines the thread priority of the thread in which the target is executed.
@NotNull EThreadPriority getPriority();
Determines the number of milliseconds the job has been running or was running.
long getMilliSecondsElapsed();
Returns the job name. The CAbstractJob class returns the ID in string form here.
@NotNull String getJobName();
Setter
The status is set using this method.
void setStatus(@NotNull EJobStatus aStatus);
Notifications
An important notification is that a job has been started.
The thread in which the job target is running is also specified here.
CAbstractJob remembers the thread, and when the job is done, it calls
mJobThread.notifyJobFinished(this)
.
void notifyJobStarted(@NotNull IJobThread aJobThread);
The counterpart is the notification when a job has been finished.
void notifyJobStopped();