Fixed issue with "double take". Added documentation

This commit is contained in:
nathan 2015-10-05 00:56:08 +02:00
parent eefbe8ea6a
commit 5793df29cf
2 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,9 @@ class SafeObjectPool<T> implements ObjectPool<T> {
@Override
public
T take() throws InterruptedException {
return this.queue.take();
final T take = this.queue.take();
poolableObject.onTake(take);
return take;
}
@SuppressWarnings({"Duplicates", "SpellCheckingInspection"})
@ -50,7 +52,6 @@ class SafeObjectPool<T> implements ObjectPool<T> {
T takeUninterruptibly() {
try {
T take = take();
poolableObject.onTake(take);
return take;
} catch (InterruptedException e) {
return null;

View File

@ -73,7 +73,6 @@ class UnsafeObjectPool<T> implements ObjectPool<T> {
T takeUninterruptibly() {
try {
final T take = take();
poolableObject.onTake(take);
return take;
} catch (InterruptedException e) {
return null;