private void waitForever() throws InterruptedException, ProcessManagerException { if(process == null) { throw new ProcessManagerException(Strings.get("null.process")); } process.waitFor(); }
private void waitForever() throws InterruptedException, ProcessManagerException { if(process == null) { throw new ProcessManagerException(Strings.get("null.process")); } process.waitFor(); }
private void writeStdin() throws ProcessManagerException { if (stdinLines == null || stdinLines.length <= 0) { return; } PrintWriter pipe = null; if(process == null) { throw new ProcessManagerException(Strings.get("null.process")); } try { pipe = new PrintWriter(new BufferedWriter(new OutputStreamWriter(process.getOutputStream()))); for (int i = 0; i < stdinLines.length; i++) { debug("InputLine ->" + stdinLines[i] + "<-"); pipe.println(stdinLines[i]); } pipe.flush(); } catch (Exception e) { throw new ProcessManagerException(e); } finally { try { pipe.close(); } catch (Throwable t) { } } }
private void writeStdin() throws ProcessManagerException { if (stdinLines == null || stdinLines.length <= 0) { return; } PrintWriter pipe = null; try { pipe = new PrintWriter(new BufferedWriter(new OutputStreamWriter(process.getOutputStream()))); for (int i = 0; i < stdinLines.length; i++) { debug("InputLine ->" + stdinLines[i] + "<-"); pipe.println(stdinLines[i]); } pipe.flush(); } catch (Exception e) { throw new ProcessManagerException(e); } finally { try { pipe.close(); } catch (Throwable t) { } } }
private void writeStdin() throws ProcessManagerException { if (stdinLines == null || stdinLines.length <= 0) { return; } PrintWriter pipe = null; if(process == null) { throw new ProcessManagerException(Strings.get("null.process")); } try { pipe = new PrintWriter(new BufferedWriter(new OutputStreamWriter(process.getOutputStream()))); for (int i = 0; i < stdinLines.length; i++) { debug("InputLine ->" + stdinLines[i] + "<-"); pipe.println(stdinLines[i]); } pipe.flush(); } catch (Exception e) { throw new ProcessManagerException(e); } finally { try { pipe.close(); } catch (Throwable t) { } } }
public int execute() throws ProcessManagerException { if (!asadmin.canExecute()) throw new ProcessManagerException("asadmin is not executable!"); pm = new ProcessManager(cmds); pm.waitForReaderThreads(waitForReaderThreads); pm.execute(); // blocks until command is complete return pm.getExitValue(); }
public int execute() throws ProcessManagerException { if (!asadmin.canExecute()) throw new ProcessManagerException("asadmin is not executable!"); pm = new ProcessManager(cmds); pm.waitForReaderThreads(waitForReaderThreads); pm.execute(); // blocks until command is complete return pm.getExitValue(); }
public int execute() throws ProcessManagerException { if (!asadmin.canExecute()) throw new ProcessManagerException("asadmin is not executable!"); pm = new ProcessManager(cmds); pm.waitForReaderThreads(waitForReaderThreads); pm.execute(); // blocks until command is complete return pm.getExitValue(); }
private static boolean isProcessRunningWindows(int aPid) throws ProcessManagerException { String pidString = Integer.toString(aPid); ProcessManager pm = new ProcessManager("tasklist", "/FI", "\"pid eq " + pidString + "\""); pm.setEcho(false); pm.execute(); String out = pm.getStdout() + pm.getStderr(); /* output is either (1) INFO: No tasks running with the specified criteria. (2) Image Name PID Session Name Session# Mem Usage ========================= ====== ================ ======== ============ java.exe 3760 Console 0 64,192 K */ if (debug) { System.out.println("------------ Output from tasklist ----------"); System.out.println(out); System.out.println("------------------------------------------------"); } if (ok(out)) { if (out.indexOf("" + aPid) >= 0) return true; else return false; } throw new ProcessManagerException("unknown"); }
private static boolean isProcessRunningWindows(int aPid) throws ProcessManagerException { String pidString = Integer.toString(aPid); ProcessManager pm = new ProcessManager("tasklist", "/NH", "/FI", "\"pid eq " + pidString + "\""); pm.setEcho(false); pm.execute(); String out = pm.getStdout() + pm.getStderr(); /* output is either (1) INFO: No tasks running with the specified criteria. (2) java.exe 3760 Console 0 64,192 K */ if (debug) { System.out.println("------------ Output from tasklist ----------"); System.out.println(out); System.out.println("------------------------------------------------"); } if (ok(out)) { // check for java.exe because tasklist or some other command might // be reusing the pid. This isn't a guarantee because some other // java process might be reusing the pid. if (out.indexOf("java.exe") >= 0 && out.indexOf(pidString) >= 0) return true; else return false; } throw new ProcessManagerException("unknown"); }
private static boolean isProcessRunningWindows(int aPid) throws ProcessManagerException { String pidString = Integer.toString(aPid); ProcessManager pm = new ProcessManager("tasklist", "/NH", "/FI", "\"pid eq " + pidString + "\""); pm.setEcho(false); pm.execute(); String out = pm.getStdout() + pm.getStderr(); /* output is either (1) INFO: No tasks running with the specified criteria. (2) java.exe 3760 Console 0 64,192 K */ if (debug) { System.out.println("------------ Output from tasklist ----------"); System.out.println(out); System.out.println("------------------------------------------------"); } if (ok(out)) { // check for java.exe because tasklist or some other command might // be reusing the pid. This isn't a guarantee because some other // java process might be reusing the pid. if (out.indexOf("java.exe") >= 0 && out.indexOf(pidString) >= 0) return true; else return false; } throw new ProcessManagerException("unknown"); }
throw new ProcessManagerException(e);
throw new ProcessManagerException(asadmin.getAbsolutePath() + " is not executable.");