Class WorkManager.ScheduleWork

    • Constructor Detail

      • ScheduleWork

        public ScheduleWork()
        Default constructor (necessary for a lite serialization).
      • ScheduleWork

        public ScheduleWork​(commonj.work.Work work,
                            long lWorkId,
                            int nMemberId,
                            boolean fFeedback)
                     throws commonj.work.WorkException
        Construct the ScheduleWork for a given Work.
        Parameters:
        work - the Work to execute
        lWorkId - the Work id
        nMemberId - the Member id
        fFeedback - true if a feedback is requested (listener)
        Throws:
        commonj.work.WorkException - thrown if serialization results in an exception
    • Method Detail

      • init

        public void init​(InvocationService service)
        Called by the InvocationService exactly once on this Invocable object as part of its initialization.
        Specified by:
        init in interface Invocable
        Overrides:
        init in class AbstractInvocable
        Parameters:
        service - the containing InvocationService
      • run

        public void run()
        Called exactly once by the InvocationService to invoke this Invocable object.
      • getExecutionTimeoutMillis

        public long getExecutionTimeoutMillis()
        Obtain the maximum amount of time this task is allowed to run before the corresponding service will attempt to stop it.

        The value of TIMEOUT_DEFAULT indicates a default timeout value configured for the corresponding service; the value of TIMEOUT_NONE indicates that this task can execute indefinitely.

        If, by the time the specified amount of time passed, the task has not finished, the service will attempt to stop the execution by using the Thread.interrupt() method. In the case that interrupting the thread does not result in the task's termination, the PriorityTask.runCanceled(boolean) method will be called.

        This implementation returns TIMEOUT_DEFAULT.

        Specified by:
        getExecutionTimeoutMillis in interface PriorityTask
        Overrides:
        getExecutionTimeoutMillis in class AbstractInvocable
        Returns:
        the execution timeout value in milliseconds or one of the special TIMEOUT_* values
      • getWork

        public commonj.work.Work getWork()
        Return a Work object.
        Returns:
        a Work object
      • getException

        public Throwable getException()
        Return a deserialization exception (if any).
        Returns:
        an exception thrown during the Work deserialization
      • isFeedbackRequested

        public boolean isFeedbackRequested()
        Return a feedback flag.
        Returns:
        a feedback flag
      • getStatus

        public int getStatus()
        Return a status of the underlying Work.
        Returns:
        a status of the underlying Work
      • setStatus

        public void setStatus​(int nStatus)
        Change a status of the underlying Work.
        Parameters:
        nStatus - a new status of the underlying Work
      • toString

        public String toString()
        Return a human-readable task description.
        Overrides:
        toString in class Object