diff --git a/test/jdk/com/sun/jmx/remote/NotificationMarshalVersions/Client/Client.java b/test/jdk/com/sun/jmx/remote/NotificationMarshalVersions/Client/Client.java index 384a08d177267..80931ca744061 100644 --- a/test/jdk/com/sun/jmx/remote/NotificationMarshalVersions/Client/Client.java +++ b/test/jdk/com/sun/jmx/remote/NotificationMarshalVersions/Client/Client.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, 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 @@ -37,6 +37,9 @@ import javax.management.remote.JMXServiceURL; public class Client { + + public static final int COUNTER_TIMEOUT_SECONDS = 60; + public static void run(String url) throws Exception { final int notifEmittedCnt = 10; final CountDownLatch counter = new CountDownLatch(notifEmittedCnt); @@ -84,8 +87,8 @@ public void handleNotification(Notification notification, Object handback) { System.out.println(); try { System.out.println("waiting for " + notifEmittedCnt + " notifications to arrive"); - if (!counter.await(30, TimeUnit.SECONDS)) { - throw new InterruptedException(); + if (!counter.await(COUNTER_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { + throw new Error("Client: Counter await expired"); } if (duplNotification.get()) { System.out.println("ERROR: received duplicated notifications"); @@ -94,7 +97,7 @@ public void handleNotification(Notification notification, Object handback) { System.out.println("\nshutting down client"); } catch (InterruptedException e) { System.out.println("ERROR: notification processing thread interrupted"); - throw new Error("notification thread interrupted unexpectedly"); + throw new Error("notification thread interrupted unexpectedly", e); } } }