Mercurial > hg > truffle
annotate test/runtime/7196045/Test7196045.java @ 11199:86af3ced0fce
Merge.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 05 Aug 2013 19:46:51 +0200 |
parents | ac7193063af8 |
children |
rev | line source |
---|---|
6779
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
1 /* |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
4 * |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
8 * |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
13 * accompanied this code). |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
14 * |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
18 * |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
21 * questions. |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
22 * |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
23 */ |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
24 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
25 /* |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
26 * @test |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
27 * @bug 7196045 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
28 * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API. |
11073
ac7193063af8
8006023: Embedded Builds fail management test because of requirement for UsePerfData being enabled.
jiangli
parents:
6832
diff
changeset
|
29 * @run main/othervm -XX:+UsePerfData Test7196045 |
6779
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
30 */ |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
31 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
32 import java.lang.management.ManagementFactory; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
33 import javax.management.JMException; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
34 import javax.management.MBeanServer; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
35 import javax.management.MalformedObjectNameException; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
36 import javax.management.ObjectName; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
37 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
38 public class Test7196045 { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
39 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
40 public static long duration = 1000 * 60 * 2; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
41 private static final String HOTSPOT_INTERNAL = "sun.management:type=HotspotInternal"; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
42 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
43 public static void main(String[] args) { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
44 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
45 MBeanServer server = ManagementFactory.getPlatformMBeanServer(); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
46 ObjectName objName= null; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
47 try { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
48 ObjectName hotspotInternal = new ObjectName(HOTSPOT_INTERNAL); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
49 try { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
50 server.registerMBean(new sun.management.HotspotInternal(), hotspotInternal); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
51 } catch (JMException e) { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
52 throw new RuntimeException("HotSpotWatcher: Failed to register the HotspotInternal MBean" + e); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
53 } |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
54 objName= new ObjectName("sun.management:type=HotspotThreading"); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
55 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
56 } catch (MalformedObjectNameException e1) { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
57 throw new RuntimeException("Bad object name" + e1); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
58 } |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
59 |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
60 long endTime = System.currentTimeMillis() + duration; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
61 long i = 0; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
62 while (true) { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
63 try { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
64 server.getAttribute(objName, "InternalThreadCpuTimes"); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
65 } catch (Exception ex) { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
66 System.err.println("Exception while getting attribute: " + ex); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
67 } |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
68 i++; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
69 if (i % 10000 == 0) { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
70 System.out.println("Successful iterations: " + i); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
71 } |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
72 if (System.currentTimeMillis() > endTime) { |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
73 break; |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
74 } |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
75 } |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
76 System.out.println("PASSED."); |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
77 } |
6af8f3562069
7196045: Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
kevinw
parents:
diff
changeset
|
78 } |