Skip to content

Commit 7da4a91

Browse files
committed
Fixing thread pool size test failures
Since the Jenkinsfile was mistakenly not using later Java versions correctly, this issue went undetected. The tests pass fine on Java 8, but 11 and higher require the core/max thread pool sizes to be adjusted in a specific order.
1 parent e62ce7f commit 7da4a91

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,15 @@ public QueryBatcher withThreadCount(int threadCount) {
368368
throw new IllegalArgumentException("threadCount must be 1 or greater");
369369
}
370370
if (threadPool != null) {
371-
logger.info("Adjusting thread pool size from {} to {}", getThreadCount(), threadCount);
372-
threadPool.setCorePoolSize(threadCount);
373-
threadPool.setMaximumPoolSize(threadCount);
371+
int currentThreadCount = getThreadCount();
372+
logger.info("Adjusting thread pool size from {} to {}", currentThreadCount, threadCount);
373+
if (threadCount >= currentThreadCount) {
374+
threadPool.setMaximumPoolSize(threadCount);
375+
threadPool.setCorePoolSize(threadCount);
376+
} else {
377+
threadPool.setCorePoolSize(threadCount);
378+
threadPool.setMaximumPoolSize(threadCount);
379+
}
374380
} else {
375381
threadCountSet = true;
376382
}

0 commit comments

Comments
 (0)