Skip to content

Commit

Permalink
Trying to ensure no blocking close on force reconnect from socket wri…
Browse files Browse the repository at this point in the history
…te timeout
  • Loading branch information
scottf committed May 31, 2024
1 parent 8a1111c commit 5f7fa40
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
5 changes: 1 addition & 4 deletions src/main/java/io/nats/client/impl/NatsConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ public void forceReconnect() throws IOException, InterruptedException {
}

void forceReconnectImpl() throws IOException, InterruptedException {
NatsConnectionWriter oldWriter = writer;

closeSocketLock.lock();
try {
updateStatus(Status.DISCONNECTED);
Expand All @@ -299,8 +297,7 @@ void forceReconnectImpl() throws IOException, InterruptedException {
try {
dataPort.close();
}
catch (IOException ignore) {
}
catch (IOException ignore) {}
finally {
dataPort = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ public void run() {
if (System.nanoTime() > writeMustBeDoneBy) {
writeWatcherTimer.cancel(); // we don't need to repeat this
connection.executeCallback((c, el) -> el.socketWriteTimeout(c));
try {
out.close();
}
catch (IOException ignore) {}
connection.getExecutor().submit(() -> {
try {
connection.forceReconnect();
Expand Down

0 comments on commit 5f7fa40

Please sign in to comment.