提交 1bdbdbb3 编写于 作者: K kohsuke

added the simplest kill method

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19440 71c3de6d-444a-0410-be80-ed276b4c234a
上级 d1a4bb7b
...@@ -596,7 +596,7 @@ THE SOFTWARE. ...@@ -596,7 +596,7 @@ THE SOFTWARE.
<dependency> <dependency>
<groupId>org.jvnet.winp</groupId> <groupId>org.jvnet.winp</groupId>
<artifactId>winp</artifactId> <artifactId>winp</artifactId>
<version>1.10</version> <version>1.11</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jvnet.hudson</groupId> <groupId>org.jvnet.hudson</groupId>
......
...@@ -77,7 +77,7 @@ public abstract class ProcessTree implements Iterable<OSProcess> { ...@@ -77,7 +77,7 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
/** /**
* To be filled in the constructor of the derived type. * To be filled in the constructor of the derived type.
*/ */
private final Map<Integer/*pid*/, OSProcess> processes = new HashMap<Integer, OSProcess>(); protected final Map<Integer/*pid*/, OSProcess> processes = new HashMap<Integer, OSProcess>();
// instantiation only allowed for subtypes in this class // instantiation only allowed for subtypes in this class
private ProcessTree() {} private ProcessTree() {}
...@@ -158,11 +158,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> { ...@@ -158,11 +158,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
return r; return r;
} }
// TODO: pending new Winp /**
// /** * Kills this process.
// * Kills this process. */
// */ public abstract void kill();
// public abstract void kill();
/** /**
* Kills this process and all the descendants. * Kills this process and all the descendants.
...@@ -266,6 +265,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> { ...@@ -266,6 +265,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
proc.destroy(); proc.destroy();
} }
public void kill() {
proc.destroy();
}
public List<String> getArguments() { public List<String> getArguments() {
return Collections.emptyList(); return Collections.emptyList();
} }
...@@ -302,6 +305,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> { ...@@ -302,6 +305,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
p.killRecursively(); p.killRecursively();
} }
public void kill() {
p.kill();
}
@Override @Override
public synchronized List<String> getArguments() { public synchronized List<String> getArguments() {
if(args==null) args = Arrays.asList(QuotedStringTokenizer.tokenize(p.getCommandLine())); if(args==null) args = Arrays.asList(QuotedStringTokenizer.tokenize(p.getCommandLine()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册