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

Simplify DefaultConnectionPool.OpenConcurrencyLimiter.tryLock #702

Merged
merged 1 commit into from May 2, 2021

Conversation

stIncMale
Copy link
Member

@stIncMale stIncMale commented Apr 29, 2021

TODO: rebase on top of master after merging #699, then request for review.

JAVA-3927

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.

Can you provide some context as to the purpose of this change? It seems like a behavioral change, but the PR title seems to indicate that it's not.

@stIncMale
Copy link
Member Author

Can you provide some context as to the purpose of this change? It seems like a behavioral change, but the PR title seems to indicate that it's not.

@jyemin Now that you know there is a commit message, is this request still actual?

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!

When locking for the purpose of using the wait/signal approach,
one does not have to account the time spent acquiring the lock
towards the timeout. While doing so may reduce the
non-deterministic duration by which a timeout is exceeded
by any implementation of a timeout, such overtime is usually negligible,
unless the lock is highly contended and/or checking the condition
before starting to wait is time-consuming.

The Java SE example for `java.util.concurrent.locks.Condition.awaitNanos`
ignores the time spent acquiring the lock. Doing so potentially reduces
responsiveness to timeouts, but does not
affect other performance characteristics, so I believe such simplification
is worth it and I should have taken this path initially.

JAVA-3927
@stIncMale stIncMale merged commit ddefdb0 into mongodb:master May 2, 2021
@stIncMale stIncMale deleted the JAVA-3927_simplify branch May 2, 2021 00:18
ispringer pushed a commit to evergage/mongo-java-driver that referenced this pull request May 16, 2023
…odb#702)

When locking for the purpose of using the wait/signal approach,
one does not have to account the time spent acquiring the lock
towards the timeout. While doing so may reduce the
non-deterministic duration by which a timeout is exceeded
by any implementation of a timeout, such overtime is usually negligible,
unless the lock is highly contended and/or checking the condition
before starting to wait is time-consuming.

The Java SE example for `java.util.concurrent.locks.Condition.awaitNanos`
ignores the time spent acquiring the lock. Doing so potentially reduces
responsiveness to timeouts, but does not
affect other performance characteristics, so I believe such simplification
is worth it and I should have taken this path initially.

JAVA-3927
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants