/** * Create an instance, drain and redirect the process' stderr and stdout to * System.err and System.out respectively. * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer redirect(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, true, false); psd.drain(); return psd; }
private void await() throws InterruptedException { if (timeout <= 0) { waitForever(); } else { waitAwhile(); } }
private static Boolean isProcessRunningUnix(int aPid) throws ProcessManagerException { ProcessManager pm = new ProcessManager("kill", "-0", "" + aPid); pm.setEcho(false); pm.execute(); int retval = pm.getExitValue(); return retval == 0 ? Boolean.TRUE : Boolean.FALSE; }
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 volatile ProcessManager instance = null; public static ProcessManager getInstance() { if (instance == null) { synchronized(ProcessManager.class) { if (instance == null) { instance = new ProcessManager(); } } } return instance; }
private void waitForever() throws InterruptedException, ProcessManagerException { if(process == null) { throw new ProcessManagerException(Strings.get("null.process")); } process.waitFor(); }
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 isProcessRunningUnix(int aPid) throws ProcessManagerException { ProcessManager pm = new ProcessManager("kill", "-0", "" + aPid); pm.setEcho(false); pm.execute(); int retval = pm.getExitValue(); return retval == 0 ? Boolean.TRUE : Boolean.FALSE; }
/** * Create an instance and drain the process' stderr and stdout * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer drain(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, false, false); psd.drain(); return psd; }
public static ProcessManager getInstance() throws Exception { ProcessManager result = singleton; if (result == null) { synchronized (MyClass.class) { result = singleton; if (result == null) { singleton = result = new ProcessManager(); } } return result; }
private void await() throws InterruptedException, ProcessManagerException { if (timeout <= 0) { waitForever(); } else { waitAwhile(); } }
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(); }
/** * Create an instance and drain the process' stderr and stdout and save it to * strings. * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer save(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, false, true); psd.drain(); return psd; }
private void await() throws InterruptedException, ProcessManagerException { if (timeout <= 0) { waitForever(); } else { waitAwhile(); } }
/** * Create an instance, drain and throw away the process' stderr and stdout output. * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer dispose(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, false, false); psd.drain(); return psd; }
/** * Create an instance and drain the process' stderr and stdout and save it to * strings. * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer save(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, false, true); psd.drain(); return psd; }
/** * Create an instance and drain the process' stderr and stdout * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer drain(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, false, false); psd.drain(); return psd; }
/** * Create an instance and drain the process' stderr and stdout and save it to * strings. * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer save(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, false, true); psd.drain(); return psd; }
/** * Create an instance, drain and throw away the process' stderr and stdout output. * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer dispose(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, false, false); psd.drain(); return psd; }
/** * Create an instance, drain and redirect the process' stderr and stdout to * System.err and System.out respectively. * @param process The Process to drain * @param processName The name will be used to name the drainer threads */ public static ProcessStreamDrainer redirect(String processName, Process process) { ProcessStreamDrainer psd = new ProcessStreamDrainer(processName, process, true, false); psd.drain(); return psd; } /**