Elffuss BraidHub

kikocis/java-driver public

JAVA-1320: prevent unnecessary task creation on empty pool (#764)

Changesetc7eb60dba5124e83528bf95fe48921cb919f05e229c77eb1b1275aa3905bc9ca
AuthorOlivier Michallat <olim7t@users.noreply.github.com> · 2016-10-24 13:30 -07:00
CommitterGitHub <noreply@github.com> · 2016-10-24 13:30 -07:00
Parents0a3b17a0cb34

Browse the files at this changeset

2 files changed

modified changelog/README.md +1 −0
@@ -5,6 +5,7 @@
55 - [bug] JAVA-1312: QueryBuilder modifies selected columns when manually selected.
66 - [improvement] JAVA-1303: Add missing BoundStatement.setRoutingKey(ByteBuffer...)
77 - [improvement] JAVA-262: Make internal executors customizable
8+- [bug] JAVA-1320: prevent unnecessary task creation on empty pool
89
910
1011 ### 3.0.4
modified driver-core/src/main/java/com/datastax/driver/core/HostConnectionPool.java +1 −2
@@ -200,11 +200,10 @@
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 }