@Override public void process(PoolEntry<HttpHost, NHttpClientConnection> entry) { if (entry.getRoute().equals(host)) { entry.updateExpiry(0, TimeUnit.MILLISECONDS); } } });
@Override public void process(PoolEntry<HttpHost, NHttpClientConnection> entry) { if (entry.getRoute().equals(host)) { entry.updateExpiry(0, TimeUnit.MILLISECONDS); } } });
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } purgePoolMap(); } finally { this.lock.unlock(); } }
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } purgePoolMap(); } finally { this.lock.unlock(); } }
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } purgePoolMap(); } finally { this.lock.unlock(); } }
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } purgePoolMap(); } finally { this.lock.unlock(); } }
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } purgePoolMap(); } finally { this.lock.unlock(); } }
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } purgePoolMap(); } finally { this.lock.unlock(); } }
@Override public void release(final E entry, final boolean reusable) { this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable && !this.isShutDown) { this.available.addFirst(entry); } else { entry.close(); } onRelease(entry); Future<E> future = pool.nextPending(); if (future != null) { this.pending.remove(future); } else { future = this.pending.poll(); } if (future != null) { this.condition.signalAll(); } } } finally { this.lock.unlock(); } }
@Override public void release(final E entry, final boolean reusable) { this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable && !this.isShutDown) { this.available.addFirst(entry); onRelease(entry); } else { entry.close(); } PoolEntryFuture<E> future = pool.nextPending(); if (future != null) { this.pending.remove(future); } else { future = this.pending.poll(); } if (future != null) { future.wakeup(); } } } finally { this.lock.unlock(); } }
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } processPendingRequests(); purgePoolMap(); } finally { this.lock.unlock(); } }
public void release(final E entry, final boolean reusable) { this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable && !this.isShutDown) { this.available.addFirst(entry); onRelease(entry); } else { entry.close(); } PoolEntryFuture<E> future = pool.nextPending(); if (future != null) { this.pending.remove(future); } else { future = this.pending.poll(); } if (future != null) { future.wakeup(); } } } finally { this.lock.unlock(); } }
/** * Enumerates all available connections. * * @since 4.3 */ protected void enumAvailable(final PoolEntryCallback<T, C> callback) { this.lock.lock(); try { final Iterator<E> it = this.available.iterator(); while (it.hasNext()) { final E entry = it.next(); callback.process(entry); if (entry.isClosed()) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.remove(entry); it.remove(); } } processPendingRequests(); purgePoolMap(); } finally { this.lock.unlock(); } }
@Override public void release(final E entry, final boolean reusable) { this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable && !this.isShutDown) { this.available.addFirst(entry); onRelease(entry); } else { entry.close(); } PoolEntryFuture<E> future = pool.nextPending(); if (future != null) { this.pending.remove(future); } else { future = this.pending.poll(); } if (future != null) { future.wakeup(); } } } finally { this.lock.unlock(); } }
public void release(final E entry, final boolean reusable) { this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable && !this.isShutDown) { this.available.addFirst(entry); onRelease(entry); } else { entry.close(); } PoolEntryFuture<E> future = pool.nextPending(); if (future != null) { this.pending.remove(future); } else { future = this.pending.poll(); } if (future != null) { future.wakeup(); } } } finally { this.lock.unlock(); } }
@Override public void release(final E entry, final boolean reusable) { this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable && !this.isShutDown) { this.available.addFirst(entry); onRelease(entry); } else { entry.close(); } PoolEntryFuture<E> future = pool.nextPending(); if (future != null) { this.pending.remove(future); } else { future = this.pending.poll(); } if (future != null) { future.wakeup(); } } } finally { this.lock.unlock(); } }
@Override public void release(final E entry, final boolean reusable) { if (entry == null) { return; } if (this.isShutDown.get()) { return; } this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable) { this.available.addFirst(entry); onRelease(entry); } else { entry.close(); } processNextPendingRequest(); } } finally { this.lock.unlock(); } fireCallbacks(); }
@Override public void release(final E entry, final boolean reusable) { if (entry == null) { return; } if (this.isShutDown.get()) { return; } this.lock.lock(); try { if (this.leased.remove(entry)) { final RouteSpecificPool<T, C, E> pool = getPool(entry.getRoute()); pool.free(entry, reusable); if (reusable) { this.available.addFirst(entry); onRelease(entry); } else { entry.close(); } processNextPendingRequest(); } } finally { this.lock.unlock(); } fireCallbacks(); }
final E lastUsed = this.available.removeLast(); lastUsed.close(); final RouteSpecificPool<T, C, E> otherpool = getPool(lastUsed.getRoute()); otherpool.remove(lastUsed);
final E lastUsed = this.available.removeLast(); lastUsed.close(); final RouteSpecificPool<T, C, E> otherpool = getPool(lastUsed.getRoute()); otherpool.remove(lastUsed);