Skip to content

Commit

Permalink
Merge pull request #162 from chrisvest/security-warning
Browse files Browse the repository at this point in the history
Use standard code pattern for releasing locks
  • Loading branch information
chrisvest committed May 27, 2024
2 parents b59011d + 197e1f4 commit bd3a332
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/test/java/blackbox/AllocatorBasedPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1007,16 +1007,19 @@ void claimMustStayWithinTimeoutEvenIfExpiredObjectIsReleased(Taps taps) throws E
assertNotNull(objs[i], "Did not claim an object in time");
}
lock.lock(); // prevent new allocations
Thread thread = fork($delayedReleases(10, TimeUnit.MILLISECONDS, objs));
try {
// must return before test times out:
GenericPoolable obj = tap.claim(new Timeout(50, TimeUnit.MILLISECONDS));
if (obj != null) {
obj.release();
Thread thread = fork($delayedReleases(10, TimeUnit.MILLISECONDS, objs));
try {
// must return before test times out:
GenericPoolable obj = tap.claim(new Timeout(50, TimeUnit.MILLISECONDS));
if (obj != null) {
obj.release();
}
} finally {
thread.interrupt();
thread.join();
}
} finally {
thread.interrupt();
thread.join();
lock.unlock();
}
}
Expand Down

0 comments on commit bd3a332

Please sign in to comment.