diff options
Diffstat (limited to 'tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java')
-rw-r--r-- | tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java b/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java index 4bb5187..b435eeb 100644 --- a/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java +++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java @@ -166,18 +166,36 @@ class ProcessAssasin extends Thread { Field f = p.getClass().getDeclaredField("pid"); f.setAccessible(true); String pid = (f.get(p)).toString(); - List<String> ll=new ArrayList<String>(4); - ll.add("kill"); - ll.add("-s"); - ll.add("SIGTERM"); - ll.add(pid); - ServerAccess.executeProcess(ll);//sync, but acctually release - //before affected application close - Thread.sleep(1000); + sigInt(pid); + //sigTerm(pid); + //sigKill(pid); } catch (Exception ex) { ServerAccess.logException(ex); } finally { p.destroy(); } } + + public static void sigInt(String pid) throws Exception { + kill(pid, "SIGINT"); + } + + public static void sigKill(String pid) throws Exception { + kill(pid, "SIGKILL"); + } + + public static void sigTerm(String pid) throws Exception { + kill(pid, "SIGTERM"); + } + + public static void kill(String pid,String signal) throws InterruptedException, Exception { + List<String> ll = new ArrayList<String>(4); + ll.add("kill"); + ll.add("-s"); + ll.add(signal); + ll.add(pid); + ServerAccess.executeProcess(ll); //sync, but acctually release + //before affected application close + Thread.sleep(1000); + } } |