< prev index next >

test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 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 
   1 /*
   2  * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 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 
< prev index next >