added the simplest kill method

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19440 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-07-06 22:16:56 +00:00
1 parent d1a4bb7bf7
commit 1bdbdbb398
2 files changed
+14 -7

No files matched your search

@@ -77,7 +77,7 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
/**
* 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
private ProcessTree() {}
@@ -158,11 +158,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
return r;
}
// TODO: pending new Winp
// /**
// * Kills this process.
// */
// public abstract void kill();
/**
* Kills this process.
*/
public abstract void kill();
/**
* Kills this process and all the descendants.
@@ -266,6 +265,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
proc.destroy();
}
public void kill() {
proc.destroy();
}
public List<String> getArguments() {
return Collections.emptyList();
}
@@ -302,6 +305,10 @@ public abstract class ProcessTree implements Iterable<OSProcess> {
p.killRecursively();
}
public void kill() {
p.kill();
}
@Override
public synchronized List<String> getArguments() {
if(args==null) args = Arrays.asList(QuotedStringTokenizer.tokenize(p.getCommandLine()));