< prev index next >

test/jdk/sun/tools/jstat/JStatInterval.java

Print this page
rev 51638 : [mq]: 8210112


   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  */
  23 
  24 /**
  25  * @test
  26  * @bug 8035668
  27  * @library /lib/testlibrary

  28  * @summary Test checks case when target application finishes execution and jstat didn't complete work.
  29             jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes
  30             after 500ms. This shouldn't cause crash or hang in target application or in jstat.
  31  * @modules java.management
  32  * @build jdk.testlibrary.* JStatInterval
  33  * @run main JStatInterval
  34  */
  35 
  36 import jdk.testlibrary.ProcessTools;
  37 import jdk.testlibrary.JDKToolLauncher;
  38 
  39 import java.util.concurrent.TimeUnit;
  40 import java.util.concurrent.atomic.AtomicBoolean;
  41 
  42 public class JStatInterval {
  43     private static final String READY = "READY";
  44     private static final String ERROR = "!ERROR";
  45 
  46     public static class Application {
  47         public static void main(String[] args) {
  48             try {
  49                 System.out.println(READY);
  50                 System.out.flush();
  51                 int exitCode = System.in.read();
  52                 Thread.sleep(500);
  53                 System.exit(exitCode);
  54             } catch (Exception e) {
  55                 System.out.println(ERROR);
  56                 System.out.flush();




   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  */
  23 
  24 /**
  25  * @test
  26  * @bug 8035668
  27  * @library /lib/testlibrary
  28  * @library /test/lib
  29  * @summary Test checks case when target application finishes execution and jstat didn't complete work.
  30             jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes
  31             after 500ms. This shouldn't cause crash or hang in target application or in jstat.
  32  * @modules java.management
  33  * @build jdk.testlibrary.* JStatInterval
  34  * @run main JStatInterval
  35  */
  36 
  37 import jdk.test.lib.process.ProcessTools;
  38 import jdk.testlibrary.JDKToolLauncher;
  39 
  40 import java.util.concurrent.TimeUnit;
  41 import java.util.concurrent.atomic.AtomicBoolean;
  42 
  43 public class JStatInterval {
  44     private static final String READY = "READY";
  45     private static final String ERROR = "!ERROR";
  46 
  47     public static class Application {
  48         public static void main(String[] args) {
  49             try {
  50                 System.out.println(READY);
  51                 System.out.flush();
  52                 int exitCode = System.in.read();
  53                 Thread.sleep(500);
  54                 System.exit(exitCode);
  55             } catch (Exception e) {
  56                 System.out.println(ERROR);
  57                 System.out.flush();


< prev index next >