Author: rmannibucau
Date: Sun Jul 6 16:12:22 2014
New Revision: 1608234
URL: http://svn.apache.org/r1608234
Log:
drainPermits should be enough
Modified:
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
Modified:
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
URL:
http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java?rev=1608234&r1=1608233&r2=1608234&view=diff
==============================================================================
---
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
(original)
+++
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
Sun Jul 6 16:12:22 2014
@@ -420,12 +420,8 @@ public class Pool<T> {
public boolean close(final long timeout, final TimeUnit unit) throws
InterruptedException {
// drain all keys so no new instances will be accepted into the pool
- while (instances.tryAcquire()) {
- //NOPMD
- }
- while (minimum.tryAcquire()) {
- //NOPMD
- }
+ instances.drainPermits();
+ minimum.drainPermits();
// flush and sweep
flush();
@@ -440,9 +436,7 @@ public class Pool<T> {
// Drain all leases
if (!(available instanceof Overdraft)) {
- while (available.tryAcquire()) {
- //NOPMD
- }
+ available.drainPermits();
}
// Wait for any pending discards