Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b16a727
Refactor ConcurrentPool so that it becomes agnostic of the item initi…
stIncMale Mar 4, 2021
f21d299
Implement maxConnecting in DefaultConnectionPool.get
stIncMale Mar 10, 2021
9371a8b
Add specification tests
stIncMale Mar 10, 2021
388a7a7
Implement integration style CMAP specification tests
stIncMale Mar 10, 2021
1e75fe0
Implement maxConnecting in DefaultConnectionPool.getAsync
stIncMale Mar 16, 2021
8360c76
Fix static validation issues
stIncMale Mar 16, 2021
045fe13
Implement runOn in AbstractConnectionPoolTest
stIncMale Mar 16, 2021
5e5c7c0
Send ConnectionCheckOutFailedEvent with Reason.CONNECTION_ERROR if fa…
stIncMale Mar 17, 2021
459466a
Address the first set of review concerns
stIncMale Mar 17, 2021
4dae245
Add an test for DefaultConnectionPool.getAsync that checks for Reason…
stIncMale Mar 18, 2021
5d203f7
Simplify DefaultConnectionPoolSpecification.selectConnectionAsync
stIncMale Mar 18, 2021
3d54d9d
Simplify ConcurrentPool.ensureMinSize
stIncMale Mar 23, 2021
26a4a7b
Replace Java assert statements with our assert methods
stIncMale Mar 24, 2021
e2bd080
Merge branch 'master' into JAVA-3927
stIncMale Mar 24, 2021
45d1891
Address naming and try-finally review concerns
stIncMale Mar 24, 2021
49a3e3c
Fix ensureMinSize call in ConcurrentPoolTest
stIncMale Mar 24, 2021
fbd5a97
Add tests for Timeout
stIncMale Mar 25, 2021
6eaf542
Introduce sync and async methods by duplicating the logic of openOrSi…
stIncMale Mar 25, 2021
f5967d1
Make it clearer that releasePermit and tryHandOver methods acquire th…
stIncMale Mar 26, 2021
1e29f20
Replace Timeout.remainingNanos with remaining(TimeUnit)
stIncMale Mar 26, 2021
d3a9195
Address review concerns
stIncMale Mar 31, 2021
fa3c23c
Undo changes in the ConnectionPoolListener specification
stIncMale Apr 1, 2021
0fedc2d
Improve docs
stIncMale Apr 3, 2021
22d3afc
Add concurrency tests for DefaultConnectionPool
stIncMale Apr 3, 2021
fbdd763
Assert all checked in connections are handed over in DefaultConnectio…
stIncMale Apr 5, 2021
ba98f3d
Address review concerns
stIncMale Apr 5, 2021
b04ff8f
Do not confuse a user with timeout exceptions caused by timeout excep…
stIncMale Apr 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make it clearer that releasePermit and tryHandOver methods acquire th…
…e lock uninterruptibly

JAVA-3927
  • Loading branch information
stIncMale committed Mar 26, 2021
commit f5967d1ae9f177a59c55a92fbdc6a52ca51f5f27
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ private PooledConnection acquirePermitOrGetAvailableOpenedConnection(final boole
}

private void releasePermit() {
lock();
lock.lock();
try {
assertTrue(permits < maxPermits);
permits++;
Expand Down Expand Up @@ -911,7 +911,7 @@ private void giveUpOnTryingToGetAvailableConnection() {
}

boolean tryHandOver(final PooledConnection openConnection) {
lock();
lock.lock();
try {
for (//iterate from first (head) to last (tail)
MutableReference<PooledConnection> desiredConnectionSlot : desiredConnectionSlots) {
Expand All @@ -931,15 +931,15 @@ boolean tryHandOver(final PooledConnection openConnection) {
}
}

private void lock() {
tryLock(Timeout.infinite());
}

/**
* @param timeout If {@linkplain Timeout#isInfinite() infinite},
* then the lock is {@linkplain Lock#lockInterruptibly() acquired interruptibly}.
*/
private void tryLock(final Timeout timeout) throws MongoTimeoutException {
boolean success;
try {
if (timeout.isInfinite()) {
lock.lock();
lock.lockInterruptibly();
success = true;
} else {
success = lock.tryLock(timeout.remainingNanos(), TimeUnit.NANOSECONDS);
Expand Down