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