From 9e69c8e35768462668994212ce412056ac4cb784 Mon Sep 17 00:00:00 2001 From: jbachorik Date: Mon, 21 Oct 2013 13:57:11 +0200 Subject: [PATCH] 7140929: NotSerializableNotifTest.java fails intermittently Reviewed-by: sjiang, alanb --- .../notif/NotSerializableNotifTest.java | 19 +++++++++++++++---- 1 file 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