Skip to content

Commit 5f7fa40

Browse files
committed
Trying to ensure no blocking close on force reconnect from socket write timeout
1 parent 8a1111c commit 5f7fa40

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

src/main/java/io/nats/client/impl/NatsConnection.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,6 @@ public void forceReconnect() throws IOException, InterruptedException {
284284
}
285285

286286
void forceReconnectImpl() throws IOException, InterruptedException {
287-
NatsConnectionWriter oldWriter = writer;
288-
289287
closeSocketLock.lock();
290288
try {
291289
updateStatus(Status.DISCONNECTED);
@@ -299,8 +297,7 @@ void forceReconnectImpl() throws IOException, InterruptedException {
299297
try {
300298
dataPort.close();
301299
}
302-
catch (IOException ignore) {
303-
}
300+
catch (IOException ignore) {}
304301
finally {
305302
dataPort = null;
306303
}

src/main/java/io/nats/client/impl/SocketDataPortWithWriteTimeout.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ public void run() {
3838
if (System.nanoTime() > writeMustBeDoneBy) {
3939
writeWatcherTimer.cancel(); // we don't need to repeat this
4040
connection.executeCallback((c, el) -> el.socketWriteTimeout(c));
41-
try {
42-
out.close();
43-
}
44-
catch (IOException ignore) {}
4541
connection.getExecutor().submit(() -> {
4642
try {
4743
connection.forceReconnect();

0 commit comments

Comments
 (0)