/** * 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, 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 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; }
/** * 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; } /**
/** * 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; } /**
/** * 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; }
public JavaClassRunner(String classpath, String[] sysprops, String classname, String[] args) throws IOException{ if(javaExe == null) throw new IOException("Can not find a jvm"); if(!ok(classname)) throw new IllegalArgumentException("classname was null"); List<String> cmdline = new LinkedList<String>(); cmdline.add(javaExe.getPath()); if(ok(classpath)) { cmdline.add("-cp"); cmdline.add(classpath); } if(sysprops != null) for(String sysprop : sysprops) cmdline.add(sysprop); cmdline.add(classname); if(args != null) for(String arg : args) cmdline.add(arg); ProcessBuilder pb = new ProcessBuilder(cmdline); Process p = pb.start(); ProcessStreamDrainer.drain(classname, p); }
public JavaClassRunner(String classpath, String[] sysprops, String classname, String[] args) throws IOException{ if(javaExe == null) throw new IOException("Can not find a jvm"); if(!ok(classname)) throw new IllegalArgumentException("classname was null"); List<String> cmdline = new LinkedList<String>(); cmdline.add(javaExe.getPath()); if(ok(classpath)) { cmdline.add("-cp"); cmdline.add(classpath); } if(sysprops != null) for(String sysprop : sysprops) cmdline.add(sysprop); cmdline.add(classname); if(args != null) for(String arg : args) cmdline.add(arg); ProcessBuilder pb = new ProcessBuilder(cmdline); Process p = pb.start(); ProcessStreamDrainer drainer = ProcessStreamDrainer.drain(classname, p); }
public JavaClassRunner(String classpath, String[] sysprops, String classname, String[] args) throws IOException{ if(javaExe == null) throw new IOException("Can not find a jvm"); if(!ok(classname)) throw new IllegalArgumentException("classname was null"); List<String> cmdline = new LinkedList<String>(); cmdline.add(javaExe.getPath()); if(ok(classpath)) { cmdline.add("-cp"); cmdline.add(classpath); } if(sysprops != null) for(String sysprop : sysprops) cmdline.add(sysprop); cmdline.add(classname); if(args != null) for(String arg : args) cmdline.add(arg); ProcessBuilder pb = new ProcessBuilder(cmdline); Process p = pb.start(); ProcessStreamDrainer.drain(classname, p); }
public final void launchJVM(List<String> cmdsIn) throws GFLauncherException { try { setup(); // we only use one thing -- the java executable List<String> commands = new LinkedList<String>(); commands.add(javaExe); for (String cmd : cmdsIn) { commands.add(cmd); } ProcessBuilder pb = new ProcessBuilder(commands); Process p = pb.start(); ProcessStreamDrainer.drain("launchJVM", p); // just to be safe } catch (GFLauncherException gfe) { throw gfe; } catch (Throwable t) { // hk2 might throw a java.lang.Error throw new GFLauncherException(strings.get("unknownError", t.getMessage()), t); } finally { GFLauncherLogger.removeLogFileHandler(); } }