@Test public void testSetMaxPerRoute() throws Exception { final StrictConnPool<String, HttpConnection> pool = new StrictConnPool<>(2, 2); pool.setMaxPerRoute("somehost", 1); Assert.assertEquals(1, pool.getMaxPerRoute("somehost")); pool.setMaxPerRoute("somehost", 0); Assert.assertEquals(0, pool.getMaxPerRoute("somehost")); pool.setMaxPerRoute("somehost", -1); Assert.assertEquals(2, pool.getMaxPerRoute("somehost")); }
@Override public void setMaxPerRoute(final T route, final int max) { Args.notNull(route, "Route"); this.lock.lock(); try { if (max > -1) { this.maxPerRoute.put(route, Integer.valueOf(max)); } else { this.maxPerRoute.remove(route); } } finally { this.lock.unlock(); } }
StrictConnPool implements ManagedConnPool<T, C> { @Override public void setMaxPerRoute(final T route, final int max) { Args.notNull(route, "Route"); this.lock.lock(); try { if (max > -1) { this.maxPerRoute.put(route, Integer.valueOf(max)); } else { this.maxPerRoute.remove(route); } } finally { this.lock.unlock(); } } }
StrictConnPool implements ManagedConnPool<T, C> { @Override public void setMaxPerRoute(final T route, final int max) { Args.notNull(route, "Route"); this.lock.lock(); try { if (max > -1) { this.maxPerRoute.put(route, Integer.valueOf(max)); } else { this.maxPerRoute.remove(route); } } finally { this.lock.unlock(); } } StrictConnPool(
            final int defaultMaxPerRoute,
            final int maxTotal,
            final TimeValue timeToLive,
            final PoolReusePolicy policy,
            final DisposalCallback<C> disposalCallback,
            final ConnPoolListener<T> connPoolListener);  StrictConnPool(
            final int defaultMaxPerRoute,
            final int maxTotal,
            final TimeValue timeToLive,
            final PoolReusePolicy policy,
            final ConnPoolListener<T> connPoolListener);  StrictConnPool(final int defaultMaxPerRoute, final int maxTotal); }
StrictConnPool implements ManagedConnPool<T, C> { @Override public void setMaxPerRoute(final T route, final int max) { Args.notNull(route, "Route"); this.lock.lock(); try { if (max > -1) { this.maxPerRoute.put(route, Integer.valueOf(max)); } else { this.maxPerRoute.remove(route); } } finally { this.lock.unlock(); } } StrictConnPool(
            final int defaultMaxPerRoute,
            final int maxTotal,
            final TimeValue timeToLive,
            final PoolReusePolicy policy,
            final DisposalCallback<C> disposalCallback,
            final ConnPoolListener<T> connPoolListener);  StrictConnPool(
            final int defaultMaxPerRoute,
            final int maxTotal,
            final TimeValue timeToLive,
            final PoolReusePolicy policy,
            final ConnPoolListener<T> connPoolListener);  StrictConnPool(final int defaultMaxPerRoute, final int maxTotal); boolean isShutdown(); @Override void close(final CloseMode closeMode); @Override void close(); @Override Future<PoolEntry<T, C>> lease(
            final T route, final Object state,
            final Timeout requestTimeout,
            final FutureCallback<PoolEntry<T, C>> callback); Future<PoolEntry<T, C>> lease(final T route, final Object state); @Override void release(final PoolEntry<T, C> entry, final boolean reusable); void validatePendingRequests(); @Override void setMaxTotal(final int max); @Override int getMaxTotal(); @Override void setDefaultMaxPerRoute(final int max); @Override int getDefaultMaxPerRoute(); @Override void setMaxPerRoute(final T route, final int max); @Override int getMaxPerRoute(final T route); @Override PoolStats getTotalStats(); @Override PoolStats getStats(final T route); @Override Set<T> getRoutes(); void enumAvailable(final Callback<PoolEntry<T, C>> callback); void enumLeased(final Callback<PoolEntry<T, C>> callback); @Override void closeIdle(final TimeValue idleTime); @Override void closeExpired(); @Override String toString(); }
StrictConnPool implements ManagedConnPool<T, C> { @Override public void setMaxPerRoute(final T route, final int max) { Args.notNull(route, "Route"); this.lock.lock(); try { if (max > -1) { this.maxPerRoute.put(route, Integer.valueOf(max)); } else { this.maxPerRoute.remove(route); } } finally { this.lock.unlock(); } } StrictConnPool(
            final int defaultMaxPerRoute,
            final int maxTotal,
            final TimeValue timeToLive,
            final PoolReusePolicy policy,
            final DisposalCallback<C> disposalCallback,
            final ConnPoolListener<T> connPoolListener);  StrictConnPool(
            final int defaultMaxPerRoute,
            final int maxTotal,
            final TimeValue timeToLive,
            final PoolReusePolicy policy,
            final ConnPoolListener<T> connPoolListener);  StrictConnPool(final int defaultMaxPerRoute, final int maxTotal); boolean isShutdown(); @Override void close(final CloseMode closeMode); @Override void close(); @Override Future<PoolEntry<T, C>> lease(
            final T route, final Object state,
            final Timeout requestTimeout,
            final FutureCallback<PoolEntry<T, C>> callback); Future<PoolEntry<T, C>> lease(final T route, final Object state); @Override void release(final PoolEntry<T, C> entry, final boolean reusable); void validatePendingRequests(); @Override void setMaxTotal(final int max); @Override int getMaxTotal(); @Override void setDefaultMaxPerRoute(final int max); @Override int getDefaultMaxPerRoute(); @Override void setMaxPerRoute(final T route, final int max); @Override int getMaxPerRoute(final T route); @Override PoolStats getTotalStats(); @Override PoolStats getStats(final T route); @Override Set<T> getRoutes(); void enumAvailable(final Callback<PoolEntry<T, C>> callback); void enumLeased(final Callback<PoolEntry<T, C>> callback); @Override void closeIdle(final TimeValue idleTime); @Override void closeExpired(); @Override String toString();  }