10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 /*
25 * @test
26 * @bug 4956978
27 * @summary The capability is disabled regardless of number of times
28 * it was enabled.
29 * @author Mandy Chung
30 * @modules java.management
31 */
32
33 import java.lang.management.ThreadMXBean;
34 import java.lang.management.ManagementFactory;
35
36 public class DisableTest {
37 private static ThreadMXBean tm = ManagementFactory.getThreadMXBean();
38
39 public static void main(String args[]) throws Exception {
40 try {
41 testThreadContentionMonitoring();
42 testThreadCpuMonitoring();
43 } finally {
44 // restore the default
45 if (tm.isThreadContentionMonitoringSupported()) {
46 tm.setThreadContentionMonitoringEnabled(false);
47 }
48 if (tm.isThreadCpuTimeSupported()) {
49 tm.setThreadCpuTimeEnabled(false);
50 }
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
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 /*
25 * @test
26 * @bug 4956978
27 * @summary The capability is disabled regardless of number of times
28 * it was enabled.
29 * @author Mandy Chung
30 */
31
32 import java.lang.management.ThreadMXBean;
33 import java.lang.management.ManagementFactory;
34
35 public class DisableTest {
36 private static ThreadMXBean tm = ManagementFactory.getThreadMXBean();
37
38 public static void main(String args[]) throws Exception {
39 try {
40 testThreadContentionMonitoring();
41 testThreadCpuMonitoring();
42 } finally {
43 // restore the default
44 if (tm.isThreadContentionMonitoringSupported()) {
45 tm.setThreadContentionMonitoringEnabled(false);
46 }
47 if (tm.isThreadCpuTimeSupported()) {
48 tm.setThreadCpuTimeEnabled(false);
49 }
|