aboutsummaryrefslogtreecommitdiff
path: root/test/javax
diff options
context:
space:
mode:
authorjbachorik <none@none>2013-10-21 13:57:11 +0200
committerjbachorik <none@none>2013-10-21 13:57:11 +0200
commit3183697b3b9815b3567f15f459d3fc31e54d518d (patch)
treecb70b4b3b028884fb4739dc6ce2f1b86b3763361 /test/javax
parent42eb498960203bdc783ccdf342807cb958c964d5 (diff)
7140929: NotSerializableNotifTest.java fails intermittently
Reviewed-by: sjiang, alanb --HG-- extra : rebase_source : 6c0344926e6768516145c91fddffedd102b4f296
Diffstat (limited to 'test/javax')
-rw-r--r--test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java b/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java
index 5901469ef..24bf863dc 100644
--- a/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java
+++ b/test/javax/management/remote/mandatory/notif/NotSerializableNotifTest.java
@@ -1,5 +1,5 @@
/*
- * 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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,8 +33,8 @@
// java imports
//
-import java.io.IOException;
import java.net.MalformedURLException;
+import java.util.Map;
// JMX imports
//
@@ -44,7 +44,7 @@ import javax.management.remote.*;
import javax.management.remote.JMXServiceURL;
public class NotSerializableNotifTest {
- private static MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
+ private static final MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
private static ObjectName emitter;
private static int port = 2468;
@@ -52,9 +52,19 @@ public class NotSerializableNotifTest {
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 {
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
final String v = System.getProperty("java.version");
float f = Float.parseFloat(v.substring(0, 3));
@@ -136,7 +146,8 @@ public class NotSerializableNotifTest {
// waiting ...
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) {
listener.wait(1000);
} else {