/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4886838 4886830
* @summary Tests that idle timeouts happen at appropriate times
* @author Eamonn McManus
* @run clean IdleTimeoutTest
* @run build IdleTimeoutTest
* @run main IdleTimeoutTest
*/
public class IdleTimeoutTest {
boolean ok = true;
else {
protos =
try {
"JMXMPConnectorServer");
} catch (ClassNotFoundException e) {
// OK: Optional JMXMP support is not present
}
}
int liCount;
else liCount=2;
else {
ok = false;
}
}
if (!ok) {
}
}
throws Exception {
try {
// Force initialization (class loading, JIT, etc...)
//
try {
} finally {
}
// Do the time measurement
//
final long endtime;
try {
} finally {
}
// multipled by 10 for a slow machine, plus 1500 for a fast one.
} finally {
}
}
private static class NotificationCounter
implements NotificationListener {
private final int[] listenerCount;
}
Object h) {
+ mbsn.getMBeanName());
synchronized (listenerCount) {
listenerCount[0]++;
}
}
return listenerName;
}
}
throws Exception {
"type=MBeanServerDelegate");
timeout + " ms");
final int[] listenerCount = new int[1];
final NotificationListener countListeners[] =
new NotificationListener[liCount];
int i;
countListeners[i] =
}
try {
try {
countListeners[i],
}
for (i = 0; i < opCount; i++) {
+"]: starting at " +
elapsed + "ms");
new ObjectName(name));
if (i == (opCount-1))
}
// Wait for notifs to arrive before doing removeNListener
synchronized (listenerCount) {
break;
}
}
"ms for notifs to arrive");
expectedCount + " notifications: "
+ listenerCount[0]);
return false;
}
elapsed + "ms");
elapsed + "ms");
"> -> <" + cid +
">");
return false;
}
return false;
}
countListeners[i]);
countListeners[i]);
}
while (true) {
break;
}
"deadline: " + ids);
return false;
}
">: idle timeout did not happen?");
return false;
} else {
connId + "> -> <" +
}
} finally {
"client close: " +
}
} finally {
}
return true;
}
}