-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Handle interrupts: Socket.connect
is interruptible in a virtual thread
#1203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -79,7 +82,9 @@ public void open() { | |||
inputStream = socket.getInputStream(); | |||
} catch (IOException e) { | |||
close(); | |||
throw new MongoSocketOpenException("Exception opening socket", getAddress(), e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth a ticket to make this consistent with read/write methods to throw IOException and do the exception transation in InternalStreamConnection. It can be dependent on the ticket to remove Stream from the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
driver-core/src/main/com/mongodb/internal/connection/SocketStream.java
Outdated
Show resolved
Hide resolved
JAVA-5138
JAVA-5138
Notably,
Socket.close
may also block if one enablesSO_LINGER
by callingSocket.setSoLinger
, yet there is not a word on interruptibility ofSocket.close
in the docs. Fortunately, we don't enableSO_LINGER
, so we don't have to care about the behavior ofSocket.close
.JAVA-5138