From 48b4a8a841039b26b9789fa43fe21ea1112b29e4 Mon Sep 17 00:00:00 2001 From: Mariusz Zawadzki Date: Tue, 12 Nov 2019 14:44:30 +0100 Subject: [PATCH] fix: fix test for machines with 2 or less available processors. --- .../tomtom/james/publisher/DisruptorAsyncPublisherSpec.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/james-agent/src/test/groovy/com/tomtom/james/publisher/DisruptorAsyncPublisherSpec.groovy b/james-agent/src/test/groovy/com/tomtom/james/publisher/DisruptorAsyncPublisherSpec.groovy index f27eff9..137d4d7 100644 --- a/james-agent/src/test/groovy/com/tomtom/james/publisher/DisruptorAsyncPublisherSpec.groovy +++ b/james-agent/src/test/groovy/com/tomtom/james/publisher/DisruptorAsyncPublisherSpec.groovy @@ -18,7 +18,7 @@ class DisruptorAsyncPublisherSpec extends Specification { private final int WORKER_COUNT = 2 - private int PUBLISHER_SIZE = Runtime.getRuntime().availableProcessors() - WORKER_COUNT + private int PUBLISHER_SIZE = Math.max(2 * WORKER_COUNT, Runtime.getRuntime().availableProcessors() - WORKER_COUNT) ExecutorService eventCreator = Executors.newFixedThreadPool(PUBLISHER_SIZE) CountingPublisher sleepingPublisher = new CountingPublisher( { it-> sleep(10)})