|
|
@@ -0,0 +1,27 @@
|
|
|
+package com.leanwo.management.service;
|
|
|
+
|
|
|
+import org.apache.commons.exec.ExecuteWatchdog;
|
|
|
+
|
|
|
+public class ExecuteWatchdogEx extends ExecuteWatchdog {
|
|
|
+
|
|
|
+ protected Process mProcess;
|
|
|
+
|
|
|
+ public ExecuteWatchdogEx(long timeout) {
|
|
|
+ super(timeout);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public synchronized void start(Process processToMonitor) {
|
|
|
+ this.mProcess = processToMonitor;
|
|
|
+ super.start(processToMonitor);
|
|
|
+ }
|
|
|
+
|
|
|
+ public synchronized boolean isAlive() {
|
|
|
+ if(mProcess == null) {
|
|
|
+ return false;
|
|
|
+ }else {
|
|
|
+ return mProcess.isAlive();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|