@@ -76,7 +76,8 @@ public MulticastSet(Stats stats, ConnectionFactory factory,
7676 this .factory = factory ;
7777 this .params = params ;
7878 this .testID = testID ;
79- this .uris = new CopyOnWriteArrayList <>(uris );
79+ this .uris = uris == null || uris .isEmpty () ?
80+ null : new CopyOnWriteArrayList <>(uris );
8081 this .completionHandler = completionHandler ;
8182 this .shutdownService = shutdownService ;
8283 this .params .init ();
@@ -126,7 +127,8 @@ public void run()
126127 public void run (boolean announceStartup )
127128 throws IOException , InterruptedException , TimeoutException , NoSuchAlgorithmException , KeyManagementException , URISyntaxException {
128129 if (waitUntilBrokerAvailableIfNecessary (params .getServersStartUpTimeout (),
129- params .getServersUpLimit () == -1 ? uris .size () : params .getServersUpLimit (),
130+ params .getServersUpLimit () == -1 ? (uris == null ? 0 : uris .size ())
131+ : params .getServersUpLimit (),
130132 uris , factory )) {
131133 ScheduledExecutorService heartbeatSenderExecutorService = this .threadingHandler .scheduledExecutorService (
132134 "perf-test-heartbeat-sender-" ,
@@ -221,7 +223,7 @@ public void run(boolean announceStartup)
221223 static boolean waitUntilBrokerAvailableIfNecessary (int startUpTimeoutInSeconds , int serversUpLimit ,
222224 Collection <String > uris , ConnectionFactory factory )
223225 throws NoSuchAlgorithmException , KeyManagementException , URISyntaxException , InterruptedException {
224- if (startUpTimeoutInSeconds <= 0 ) {
226+ if (startUpTimeoutInSeconds <= 0 || uris == null || uris . isEmpty () ) {
225227 // we don't test the connection to the broker
226228 return true ;
227229 } else {
@@ -458,7 +460,7 @@ private static void dispose(Connection connection) {
458460 }
459461
460462 private void setUri () throws URISyntaxException , NoSuchAlgorithmException , KeyManagementException {
461- if (uris != null ) {
463+ if (uris != null && ! uris . isEmpty () ) {
462464 factory .setUri (uri ());
463465 }
464466 }
0 commit comments