Skip to content

Commit 0791568

Browse files
authored
Merge pull request #1667 from marklogic/feature/threadCount-fix
Fixing thread pool size test failures
2 parents e62ce7f + 7da4a91 commit 0791568

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)