1 /*
2 * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 6338874
27 * @summary Check that notification dispatch is not linear in number of MBeans.
28 * @author Eamonn McManus
29 */
30
31 /*
32 * The notification dispatch logic in the connector server used to be
33 * linear in the number of listeners there were on any MBean. For
34 * example, if there were 1000 MBeans, each with one listener, then
35 * every time a notification was sent it would be compared against
36 * every one of the 1000 MBeans, even though its source ObjectName was
37 * known and could not possibly match the name of 999 of the MBeans.
38 * This test checks that we no longer have linear behaviour. We do
39 * this by registering just one MBean and measuring the time it takes
40 * to send and receive a certain number of notifications from that
41 * MBean. Then we register many other MBeans, each with a listener,
42 * and we make the same measurement as before. The presence of the
43 * extra MBeans with their listeners should not impact the dispatch
44 * time significantly. If it does, the test fails.
45 *
46 * As usual with timing-sensitive tests, we could potentially get
47 * sporadic failures. We fail if the ratio of the time with many
48 * MBeans to the time with just one MBean is more than 500. With the
|
1 /*
2 * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 6338874
27 * @summary Check that notification dispatch is not linear in number of MBeans.
28 * @author Eamonn McManus
29 * @modules java.management
30 */
31
32 /*
33 * The notification dispatch logic in the connector server used to be
34 * linear in the number of listeners there were on any MBean. For
35 * example, if there were 1000 MBeans, each with one listener, then
36 * every time a notification was sent it would be compared against
37 * every one of the 1000 MBeans, even though its source ObjectName was
38 * known and could not possibly match the name of 999 of the MBeans.
39 * This test checks that we no longer have linear behaviour. We do
40 * this by registering just one MBean and measuring the time it takes
41 * to send and receive a certain number of notifications from that
42 * MBean. Then we register many other MBeans, each with a listener,
43 * and we make the same measurement as before. The presence of the
44 * extra MBeans with their listeners should not impact the dispatch
45 * time significantly. If it does, the test fails.
46 *
47 * As usual with timing-sensitive tests, we could potentially get
48 * sporadic failures. We fail if the ratio of the time with many
49 * MBeans to the time with just one MBean is more than 500. With the
|