com.h3c.util

## Class Task

- java.lang.Object
- - java.lang.Thread
  - - com.h3c.util.Task

- All Implemented Interfaces:
    Runnable

      public abstract class Task
      extends Thread

  Thread capable of reporting high-level processing status and responding to a cease request.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.lang.Thread

      `Thread.State, Thread.UncaughtExceptionHandler`

  - ### Field Summary

    - ### Fields inherited from class java.lang.Thread

      `MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Task(String name)` Create a new task with the specified name.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cease()` Request peaceful shutdown of the task.
    `static void` | `delay(int ms)` Utility method to pause the current thread.
    `boolean` | `isIdle()` Provides an indication whether the task is currently busy or not.
    `protected boolean` | `stopped()` Indicates whether the task has been stopped.

    - ### Methods inherited from class java.lang.Thread

      `activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Task

          protected Task(String name)

      Create a new task with the specified name.
      Parameters:
        `name` - name of the task

  - ### Method Detail

    - #### cease

          public void cease()

      Request peaceful shutdown of the task.

    - #### stopped

          protected boolean stopped()

      Indicates whether the task has been stopped.
      Returns:
        true if stopped

    - #### isIdle

          public boolean isIdle()

      Provides an indication whether the task is currently busy or not.
      Returns:
        true if the task is idle (not busy); false otherwise; the default implementation is always true

    - #### delay

          public static void delay(int ms)

      Utility method to pause the current thread.
      Parameters:
        `ms` - number of milliseconds to pause

Copyright © 2014. All Rights Reserved.