类 ExecuteWatchdog

java.lang.Object
com.sh.common.exec.ExecuteWatchdog
所有已实现的接口:
TimeoutObserver

public class ExecuteWatchdog extends Object implements TimeoutObserver
Description: Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final long
    The marker for an infinite timeout
  • 构造器概要

    构造器
    构造器
    说明
    ExecuteWatchdog(long timeout)
    Creates a new watchdog with a given timeout.
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    This method will rethrow the exception that was possibly caught during the run of the process.
    protected void
    reset the monitor flag and the process.
    void
    Destroys the running process manually.
    boolean
    Indicates whether or not the watchdog is still monitoring the process.
    boolean
    Indicates whether the last process run was killed.
    void
    start(Process process)
    Watches the given process and terminates it, if it runs for too long.
    void
    Stops the watcher.
    void
    Called after watchdog has finished.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • INFINITE_TIMEOUT

      public static final long INFINITE_TIMEOUT
      The marker for an infinite timeout
      另请参阅:
  • 构造器详细资料

    • ExecuteWatchdog

      public ExecuteWatchdog(long timeout)
      Creates a new watchdog with a given timeout.
      参数:
      timeout - the timeout for the process in milliseconds. It must be greater than 0 or 'INFINITE_TIMEOUT'
  • 方法详细资料

    • start

      public void start(Process process)
      Watches the given process and terminates it, if it runs for too long. All information from the previous run are reset.
      参数:
      process - the process to monitor. It cannot be null
      抛出:
      IllegalStateException - if a process is still being monitored.
    • stop

      public void stop()
      Stops the watcher. It will notify all threads possibly waiting on this object.
    • destroyProcess

      public void destroyProcess()
      Destroys the running process manually.
    • timeoutOccured

      public void timeoutOccured(Watchdog w)
      Called after watchdog has finished.
      指定者:
      timeoutOccured 在接口中 TimeoutObserver
      参数:
      w - the watchdog that timed out.
    • checkException

      public void checkException() throws Exception
      This method will rethrow the exception that was possibly caught during the run of the process. It will only remains valid once the process has been terminated either by 'error', timeout or manual intervention. Information will be discarded once a new process is ran.
      抛出:
      Exception - a wrapped exception over the one that was silently swallowed and stored during the process run.
    • isWatching

      public boolean isWatching()
      Indicates whether or not the watchdog is still monitoring the process.
      返回:
      true if the process is still running, otherwise false.
    • killedProcess

      public boolean killedProcess()
      Indicates whether the last process run was killed.
      返回:
      true if the process was killed false.
    • cleanUp

      protected void cleanUp()
      reset the monitor flag and the process.