类 ExecuteWatchdog
java.lang.Object
com.sh.common.exec.ExecuteWatchdog
- 所有已实现的接口:
TimeoutObserver
Description:
Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidThis method will rethrow the exception that was possibly caught during the run of the process.protected voidcleanUp()reset the monitor flag and the process.voidDestroys the running process manually.booleanIndicates whether or not the watchdog is still monitoring the process.booleanIndicates whether the last process run was killed.voidWatches the given process and terminates it, if it runs for too long.voidstop()Stops the watcher.voidCalled after watchdog has finished.
-
字段详细资料
-
INFINITE_TIMEOUT
public static final long INFINITE_TIMEOUTThe 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
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
Called after watchdog has finished.- 指定者:
timeoutOccured在接口中TimeoutObserver- 参数:
w- the watchdog that timed out.
-
checkException
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.
-