Skip to content
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

Handle interrupts: Socket.connect is interruptible in a virtual thread #1203

Merged
merged 4 commits into from
Sep 29, 2023

Conversation

stIncMale
Copy link
Member

@stIncMale stIncMale commented Sep 25, 2023

Notably, Socket.close may also block if one enables SO_LINGER by calling Socket.setSoLinger, yet there is not a word on interruptibility of Socket.close in the docs. Fortunately, we don't enable SO_LINGER, so we don't have to care about the behavior of Socket.close.

JAVA-5138

@stIncMale stIncMale self-assigned this Sep 25, 2023
JAVA-5138
Copy link
Contributor

@jyemin jyemin left a 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);
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stIncMale added a commit to stIncMale/mongo-java-driver that referenced this pull request Sep 29, 2023
@stIncMale stIncMale merged commit ea4647b into mongodb:master Sep 29, 2023
56 checks passed
@stIncMale stIncMale deleted the JAVA-5138 branch September 29, 2023 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants