4823N/A/*
4823N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4823N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4823N/A *
4823N/A * This code is free software; you can redistribute it and/or modify it
4823N/A * under the terms of the GNU General Public License version 2 only, as
4823N/A * published by the Free Software Foundation.
4823N/A *
4823N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4823N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4823N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4823N/A * version 2 for more details (a copy is included in the LICENSE file that
4823N/A * accompanied this code).
4823N/A *
4823N/A * You should have received a copy of the GNU General Public License version
4823N/A * 2 along with this work; if not, write to the Free Software Foundation,
4823N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4823N/A *
4823N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4823N/A * or visit www.oracle.com if you need additional information or have any
4823N/A * questions.
4823N/A */
4823N/A
4823N/Aimport java.io.RandomAccessFile;
4823N/A
4823N/Apublic class JMXStartStopDoSomething {
4823N/A
4823N/A
4823N/A public void doSomething(){
4823N/A try {
4823N/A for (int i=0; i < 10; ++i) {
4823N/A RandomAccessFile f = new RandomAccessFile("/dev/null","r");
4823N/A int n = f.read();
4823N/A f.close();
4823N/A }
4823N/A
4823N/A } catch (Throwable e) {
4823N/A System.err.println("Something bad happens:" +e);
4823N/A }
4823N/A }
4823N/A
4823N/A public static void main(String args[]) throws Exception {
4823N/A System.err.println("main enter");
4823N/A int count = 1;
4823N/A while(count > 0) {
4823N/A JMXStartStopDoSomething p = new JMXStartStopDoSomething();
4823N/A p.doSomething();
4823N/A Thread.sleep(1);
4823N/A }
4823N/A // System.err.println("main exit");
4823N/A }
4823N/A}