< prev index next >

test/hotspot/jtreg/runtime/Safepoint/TestAbortVMOnSafepointTimeout.java

Print this page
rev 59076 : [mq]: 8243945


  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 import jdk.test.lib.*;
  25 import jdk.test.lib.process.*;
  26 
  27 /*
  28  * @test TestAbortVMOnSafepointTimeout
  29  * @summary Check if VM can kill thread which doesn't reach safepoint.
  30  * @bug 8219584 8227528
  31  * @requires vm.compiler2.enabled
  32  * @library /test/lib
  33  * @modules java.base/jdk.internal.misc
  34  *          java.management

  35  */
  36 
  37 public class TestAbortVMOnSafepointTimeout {
  38 
  39     public static void main(String[] args) throws Exception {
  40         if (args.length > 0) {
  41             int result = test_loop(3);
  42             System.out.println("This message would occur after some time with result " + result);
  43             return;
  44         }
  45 
  46         testWith(500, 500);
  47     }
  48 
  49     static int test_loop(int x) {
  50         int sum = 0;
  51         if (x != 0) {
  52             // Long running loop without safepoint.
  53             for (int y = 1; y < Integer.MAX_VALUE; ++y) {
  54                 if (y % x == 0) ++sum;




  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 import jdk.test.lib.*;
  25 import jdk.test.lib.process.*;
  26 
  27 /*
  28  * @test TestAbortVMOnSafepointTimeout
  29  * @summary Check if VM can kill thread which doesn't reach safepoint.
  30  * @bug 8219584 8227528
  31  * @requires vm.compiler2.enabled
  32  * @library /test/lib
  33  * @modules java.base/jdk.internal.misc
  34  *          java.management
  35  * @run driver TestAbortVMOnSafepointTimeout
  36  */
  37 
  38 public class TestAbortVMOnSafepointTimeout {
  39 
  40     public static void main(String[] args) throws Exception {
  41         if (args.length > 0) {
  42             int result = test_loop(3);
  43             System.out.println("This message would occur after some time with result " + result);
  44             return;
  45         }
  46 
  47         testWith(500, 500);
  48     }
  49 
  50     static int test_loop(int x) {
  51         int sum = 0;
  52         if (x != 0) {
  53             // Long running loop without safepoint.
  54             for (int y = 1; y < Integer.MAX_VALUE; ++y) {
  55                 if (y % x == 0) ++sum;


< prev index next >