Skip to content

Commit 01b17f8

Browse files
authored
Merge pull request #54 from rethinkdb/release-candidate/2.4.3-hotfixes
Release with hotfixes
2 parents a589e79 + ddfde38 commit 01b17f8

File tree

4 files changed

+303
-185
lines changed

4 files changed

+303
-185
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ plugins {
1313
id("com.jfrog.bintray") version "1.8.4"
1414
}
1515

16-
version = "2.4.3"
16+
version = "2.4.4"
1717
group = "com.rethinkdb"
1818

1919
java.sourceCompatibility = JavaVersion.VERSION_1_8

src/main/java/com/rethinkdb/net/DefaultConnectionFactory.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Map;
1919
import java.util.concurrent.CompletableFuture;
2020
import java.util.concurrent.ConcurrentHashMap;
21+
import java.util.concurrent.atomic.AtomicReference;
2122

2223
/**
2324
* The default {@link ConnectionSocket.Factory} and {@link ResponsePump.Factory} for any default connections.
@@ -177,6 +178,7 @@ public String toString() {
177178
}
178179

179180
private static class ThreadResponsePump implements ResponsePump {
181+
private final AtomicReference<Throwable> shutdownReason = new AtomicReference<>();
180182
private final Thread thread;
181183
private Map<Long, CompletableFuture<Response>> awaiting = new ConcurrentHashMap<>();
182184

@@ -220,7 +222,7 @@ public ThreadResponsePump(ConnectionSocket socket, boolean daemon) {
220222
@Override
221223
public @NotNull CompletableFuture<Response> await(long token) {
222224
if (awaiting == null) {
223-
throw new ReqlDriverError("Response pump closed.");
225+
throw new ReqlDriverError("Response pump closed.", shutdownReason.get());
224226
}
225227
CompletableFuture<Response> future = new CompletableFuture<>();
226228
awaiting.put(token, future);
@@ -234,6 +236,7 @@ public boolean isAlive() {
234236

235237
private void shutdown(Throwable t) {
236238
Map<Long, CompletableFuture<Response>> awaiting = this.awaiting;
239+
this.shutdownReason.compareAndSet(null, t);
237240
this.awaiting = null;
238241
thread.interrupt();
239242
if (awaiting != null) {
@@ -243,7 +246,7 @@ private void shutdown(Throwable t) {
243246

244247
@Override
245248
public void shutdownPump() {
246-
shutdown(new ReqlDriverError("Response pump closed."));
249+
shutdown(new Throwable("Shutdown was requested."));
247250
}
248251

249252
@Override

0 commit comments

Comments
 (0)