Enum WorkerStatus

  • All Implemented Interfaces:
    Serializable, Comparable<WorkerStatus>

    public enum WorkerStatus
    extends Enum<WorkerStatus>
    Status describing WorkerLifecycleStatus.ACTIVE workers. This status determines whether a worker is considered as available for dispatcher to assign work to or not.

    Those statuses are stored in WORKER_STATUS table. This table is append-only to prevent from excessive table locking when the status is updated by multiple workers at the same time. Status for a worker is computed as the newest row for given WORKER_ID in the table.

    • Enum Constant Detail

      • AVAILABLE

        public static final WorkerStatus AVAILABLE
        Worker is operational and work could be assigned to it.

        This status is assigned to worker right after creation of the worker, or when the Worker finishes the execution.

      • WORK_ASSIGNED

        public static final WorkerStatus WORK_ASSIGNED
        Worker gets this status assigned once the Dispatcher assigns work to it.
      • IN_PROGRESS

        public static final WorkerStatus IN_PROGRESS
        Worker class sets this status on the beginning of execution.
      • SCHEDULED_FOR_CANCELLATION

        public static final WorkerStatus SCHEDULED_FOR_CANCELLATION
        If a new row with cancelOngoingExecution: true flag is added to the input queue, worker gets this status assigned by the Dispatcher. Then the Worker, in each iteration, checks if it needs to stop its execution.
    • Method Detail

      • values

        public static WorkerStatus[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (WorkerStatus c : WorkerStatus.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static WorkerStatus valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null