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

ResourcePool get release semaphore only on exception #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

avmohan
Copy link

@avmohan avmohan commented May 15, 2024

The timed get in ResourcePool is releasing semaphore in a finally block which means it will be released even if resource was acquired successfully. Isn't the semaphore supposed to track the number of resources available in the pool?

The semaphore should only be released if a resource could not be acquired in the given time (i.e. returns null) or throws some exception. Otherwise it should not be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant