302 // sleep, if this is not the last iteration
303 if (i < n - 1) {
304 try {
305 Thread.sleep(params.pause);
306 } catch (InterruptedException e) {
307 sectionWriter.printf(
308 "WARNING: interrupted while sleeping between invocations");
309 e.printStackTrace(sectionWriter);
310 }
311 }
312 }
313 } else {
314 run(section.getWriter(), section.getWriter(), process, params);
315 }
316 }
317
318 /**
319 * Special values for prepareProcess exit code.
320 *
321 * <p>Can we clash with normal codes?
322 * On Solaris and Linux, only [0..255] are returned.
323 * On Windows, prepareProcess exit codes are stored in unsigned int.
324 * On MacOSX no limits (except it should fit C int type)
325 * are defined in the exit() man pages.
326 */
327 private static class ExitCode {
328 /** Process exits gracefully */
329 public static final ExitCode OK = new ExitCode(0);
330 /** Error launching prepareProcess */
331 public static final ExitCode LAUNCH_ERROR = new ExitCode(-1);
332 /** Application prepareProcess has been killed by watchdog due to timeout */
333 public static final ExitCode TIMED_OUT = new ExitCode(-2);
334 /** Application prepareProcess has never been started due to program logic */
335 public static final ExitCode NEVER_STARTED = new ExitCode(-3);
336
337 public final int value;
338
339 private ExitCode(int value) {
340 this.value = value;
341 }
342
|
302 // sleep, if this is not the last iteration
303 if (i < n - 1) {
304 try {
305 Thread.sleep(params.pause);
306 } catch (InterruptedException e) {
307 sectionWriter.printf(
308 "WARNING: interrupted while sleeping between invocations");
309 e.printStackTrace(sectionWriter);
310 }
311 }
312 }
313 } else {
314 run(section.getWriter(), section.getWriter(), process, params);
315 }
316 }
317
318 /**
319 * Special values for prepareProcess exit code.
320 *
321 * <p>Can we clash with normal codes?
322 * On Linux, only [0..255] are returned.
323 * On Windows, prepareProcess exit codes are stored in unsigned int.
324 * On MacOSX no limits (except it should fit C int type)
325 * are defined in the exit() man pages.
326 */
327 private static class ExitCode {
328 /** Process exits gracefully */
329 public static final ExitCode OK = new ExitCode(0);
330 /** Error launching prepareProcess */
331 public static final ExitCode LAUNCH_ERROR = new ExitCode(-1);
332 /** Application prepareProcess has been killed by watchdog due to timeout */
333 public static final ExitCode TIMED_OUT = new ExitCode(-2);
334 /** Application prepareProcess has never been started due to program logic */
335 public static final ExitCode NEVER_STARTED = new ExitCode(-3);
336
337 public final int value;
338
339 private ExitCode(int value) {
340 this.value = value;
341 }
342
|