提交 9e69c8e3 编写于 作者: J jbachorik

7140929: NotSerializableNotifTest.java fails intermittently

Reviewed-by: sjiang, alanb
上级 5d3d9b5f
/* /*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
// java imports // java imports
// //
import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.Map;
// JMX imports // JMX imports
// //
...@@ -44,7 +44,7 @@ import javax.management.remote.*; ...@@ -44,7 +44,7 @@ import javax.management.remote.*;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
public class NotSerializableNotifTest { public class NotSerializableNotifTest {
private static MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer(); private static final MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
private static ObjectName emitter; private static ObjectName emitter;
private static int port = 2468; private static int port = 2468;
...@@ -52,9 +52,19 @@ public class NotSerializableNotifTest { ...@@ -52,9 +52,19 @@ public class NotSerializableNotifTest {
private static final int sentNotifs = 10; private static final int sentNotifs = 10;
private static double timeoutFactor = 1.0;
private static final double defaultTimeout = 10;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
System.out.println(">>> Test to send a not serializable notification"); System.out.println(">>> Test to send a not serializable notification");
String timeoutVal = System.getProperty("test.timeout.factor");
if (timeoutVal != null) {
timeoutFactor = Double.parseDouble(
System.getProperty("test.timeout.factor")
);
}
// IIOP fails on JDK1.4, see 5034318 // IIOP fails on JDK1.4, see 5034318
final String v = System.getProperty("java.version"); final String v = System.getProperty("java.version");
float f = Float.parseFloat(v.substring(0, 3)); float f = Float.parseFloat(v.substring(0, 3));
...@@ -136,7 +146,8 @@ public class NotSerializableNotifTest { ...@@ -136,7 +146,8 @@ public class NotSerializableNotifTest {
// waiting ... // waiting ...
synchronized (listener) { synchronized (listener) {
for (int i=0; i<10; i++) { int top = (int)Math.ceil(timeoutFactor * defaultTimeout);
for (int i=0; i<top; i++) {
if (listener.received() < sentNotifs) { if (listener.received() < sentNotifs) {
listener.wait(1000); listener.wait(1000);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册