@Test public void testConnectionPoolCleaner() throws Exception { ConfigurationManager.getConfigInstance().setProperty("ConnectionPoolCleanerTest.ribbon." + CommonClientConfigKey.ConnIdleEvictTimeMilliSeconds, "100"); ConfigurationManager.getConfigInstance().setProperty("ConnectionPoolCleanerTest.ribbon." + CommonClientConfigKey.ConnectionCleanerRepeatInterval, "500"); RestClient client = (RestClient) ClientFactory.getNamedClient("ConnectionPoolCleanerTest"); NFHttpClient httpclient = NFHttpClientFactory.getNamedNFHttpClient("ConnectionPoolCleanerTest"); assertNotNull(httpclient); com.netflix.client.http.HttpResponse response = null; try { response = client.execute(HttpRequest.newBuilder().uri(server.getServerPath("/")).build()); } finally { if (response != null) { response.close(); } } MonitoredConnectionManager connectionPoolManager = (MonitoredConnectionManager) httpclient.getConnectionManager(); Thread.sleep(2000); assertEquals(0, connectionPoolManager.getConnectionsInPool()); client.shutdown(); }
@Override public void shutdown() { super.shutdown(); Monitors.unregisterObject(name, this); }
NamedConnectionPool extends ConnPoolByRoute { @Override public void shutdown() { super.shutdown(); Monitors.unregisterObject(name, this); } }
NamedConnectionPool extends ConnPoolByRoute { @Override public void shutdown() { super.shutdown(); Monitors.unregisterObject(name, this); } NamedConnectionPool(String name, ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections, long connTTL,
            TimeUnit connTTLTimeUnit);  NamedConnectionPool(String name, ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections);  NamedConnectionPool(String name, ClientConnectionOperator operator,
            HttpParams params);   NamedConnectionPool(ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections, long connTTL,
            TimeUnit connTTLTimeUnit);   NamedConnectionPool(ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections);   NamedConnectionPool(ClientConnectionOperator operator,
            HttpParams params); }
NamedConnectionPool extends ConnPoolByRoute { @Override public void shutdown() { super.shutdown(); Monitors.unregisterObject(name, this); } NamedConnectionPool(String name, ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections, long connTTL,
            TimeUnit connTTLTimeUnit);  NamedConnectionPool(String name, ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections);  NamedConnectionPool(String name, ClientConnectionOperator operator,
            HttpParams params);   NamedConnectionPool(ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections, long connTTL,
            TimeUnit connTTLTimeUnit);   NamedConnectionPool(ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections);   NamedConnectionPool(ClientConnectionOperator operator,
            HttpParams params); @Override PoolEntryRequest requestPoolEntry(HttpRoute route, Object state); @Override void freeEntry(BasicPoolEntry entry, boolean reusable,
            long validDuration, TimeUnit timeUnit); final long getFreeEntryCount(); final long getCreatedEntryCount(); final long getRequestsCount(); final long getReleaseCount(); final long getDeleteCount(); @Monitor(name="connectionCount", type=DataSourceType.GAUGE) int getConnectionCount(); @Override void shutdown(); }
NamedConnectionPool extends ConnPoolByRoute { @Override public void shutdown() { super.shutdown(); Monitors.unregisterObject(name, this); } NamedConnectionPool(String name, ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections, long connTTL,
            TimeUnit connTTLTimeUnit);  NamedConnectionPool(String name, ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections);  NamedConnectionPool(String name, ClientConnectionOperator operator,
            HttpParams params);   NamedConnectionPool(ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections, long connTTL,
            TimeUnit connTTLTimeUnit);   NamedConnectionPool(ClientConnectionOperator operator,
            ConnPerRoute connPerRoute, int maxTotalConnections);   NamedConnectionPool(ClientConnectionOperator operator,
            HttpParams params); @Override PoolEntryRequest requestPoolEntry(HttpRoute route, Object state); @Override void freeEntry(BasicPoolEntry entry, boolean reusable,
            long validDuration, TimeUnit timeUnit); final long getFreeEntryCount(); final long getCreatedEntryCount(); final long getRequestsCount(); final long getReleaseCount(); final long getDeleteCount(); @Monitor(name="connectionCount", type=DataSourceType.GAUGE) int getConnectionCount(); @Override void shutdown();  }