--- a/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java Fri Jun 18 16:16:51 2010 +0100
+++ b/jdk/test/java/lang/management/ThreadMXBean/DisableTest.java Fri Jun 18 09:35:22 2010 -0700
@@ -36,8 +36,18 @@
private static ThreadMXBean tm = ManagementFactory.getThreadMXBean();
public static void main(String args[]) throws Exception {
- testThreadContentionMonitoring();
- testThreadCpuMonitoring();
+ try {
+ testThreadContentionMonitoring();
+ testThreadCpuMonitoring();
+ } finally {
+ // restore the default
+ if (tm.isThreadContentionMonitoringSupported()) {
+ tm.setThreadContentionMonitoringEnabled(false);
+ }
+ if (tm.isThreadCpuTimeSupported()) {
+ tm.setThreadCpuTimeEnabled(false);
+ }
+ }
System.out.println("Test passed.");
}