Fixed issue with "double take". Added documentation
This commit is contained in:
parent
eefbe8ea6a
commit
5793df29cf
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue