2929import com .rabbitmq .client .impl .recovery .AutorecoveringConnection ;
3030import com .rabbitmq .perf .PerfTest .EXIT_WHEN ;
3131import java .io .IOException ;
32- import java .math .BigDecimal ;
3332import java .net .URISyntaxException ;
3433import java .security .KeyManagementException ;
3534import java .security .NoSuchAlgorithmException ;
@@ -148,10 +147,8 @@ protected static int nbThreadsForProducerScheduledExecutorService(MulticastParam
148147 : params .getPublishingInterval ();
149148 long publishingIntervalMs = publishingInterval .toMillis ();
150149
151- BigDecimal publishingIntervalSeconds = new BigDecimal (publishingIntervalMs )
152- .divide (new BigDecimal (1000 ));
153- BigDecimal rate = new BigDecimal (producerThreadCount )
154- .divide (publishingIntervalSeconds );
150+ double publishingIntervalSeconds = (double ) publishingIntervalMs / 1000d ;
151+ double rate = (double ) producerThreadCount / publishingIntervalSeconds ;
155152 /**
156153 * Why 100? This is arbitrary. We assume 1 thread is more than enough to handle
157154 * the publishing of 100 messages in 1 second, the fastest rate
@@ -162,10 +159,10 @@ protected static int nbThreadsForProducerScheduledExecutorService(MulticastParam
162159 * which seems reasonable.
163160 * There's a command line argument to override this anyway.
164161 */
165- int threadCount = rate . intValue () / 100 + 1 ;
162+ int threadCount = ( int ) ( rate / 100d ) + 1 ;
166163 LOGGER .debug ("Using {} thread(s) to schedule {} publisher(s) publishing every {} ms" ,
167164 threadCount , producerThreadCount , publishingInterval .toMillis ()
168- );
165+ );
169166 return threadCount ;
170167 } else {
171168 return producerExecutorServiceNbThreads ;
0 commit comments