Skip to content

Commit 059270c

Browse files
committed
Merge branch '3.0.x' into 3.1.x
2 parents 50627fd + 6f35f22 commit 059270c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Merged from 2.1 branch:
109109
- [bug] JAVA-1312: QueryBuilder modifies selected columns when manually selected.
110110
- [improvement] JAVA-1303: Add missing BoundStatement.setRoutingKey(ByteBuffer...)
111111
- [improvement] JAVA-262: Make internal executors customizable
112+
- [bug] JAVA-1320: prevent unnecessary task creation on empty pool
112113

113114

114115
### 3.0.4

driver-core/src/main/java/com/datastax/driver/core/HostConnectionPool.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,10 @@ ListenableFuture<Connection> borrowConnection(int maxQueueSize) {
200200
int coreSize = options().getCoreConnectionsPerHost(hostDistance);
201201
if (coreSize == 0) {
202202
maybeSpawnNewConnection();
203-
} else {
203+
} else if (scheduledForCreation.compareAndSet(0, coreSize)) {
204204
for (int i = 0; i < coreSize; i++) {
205205
// We don't respect MAX_SIMULTANEOUS_CREATION here because it's only to
206206
// protect against creating connection in excess of core too quickly
207-
scheduledForCreation.incrementAndGet();
208207
manager.blockingExecutor().submit(newConnectionTask);
209208
}
210209
}

driver-core/src/main/java/com/datastax/driver/core/ThreadingOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public ExecutorService createBlockingExecutor(String clusterName) {
9797
2, 2,
9898
DEFAULT_THREAD_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
9999
new LinkedBlockingQueue<Runnable>(),
100-
createThreadFactory(clusterName, "worker"));
100+
createThreadFactory(clusterName, "blocking-task-worker"));
101101
executor.allowCoreThreadTimeOut(true);
102102
return executor;
103103
}

0 commit comments

Comments
 (0)