List of usage examples for org.apache.http.pool PoolStats getMax
public int getMax()
From source file:com.yahoo.sql4d.sql4ddriver.DruidNodeAccessor.java
public static Map<String, Integer> getConnectionPoolStats() { Map<String, Integer> stats = new HashMap<>(); PoolStats poolStats = pool.getTotalStats(); stats.put("availableConnections", poolStats.getAvailable()); stats.put("maxConnections", poolStats.getMax()); stats.put("leasedConnections", poolStats.getLeased()); stats.put("pendingConnections", poolStats.getPending()); stats.put("defaultMaxPerRoute", pool.getDefaultMaxPerRoute()); return stats; }
From source file:com.joyent.manta.http.PoolStatsMBean.java
/** * Utility method that pulls an attribute's value from the statistics object. * @param attribute attribute to pull/*from ww w . j a v a 2s. com*/ * @param stats status object to query * @return result as integer or null if no mapping exists */ private static Integer getAttributeFromPoolStats(final String attribute, final PoolStats stats) { switch (attribute) { case "leased": return stats.getLeased(); case "pending": return stats.getPending(); case "available": return stats.getAvailable(); case "max": return stats.getMax(); default: return null; } }
From source file:com.ok2c.lightmtp.impl.pool.MailIOSessionManager.java
private String formatStats(final SessionEndpoint endpoint) { final StringBuilder buf = new StringBuilder(); final PoolStats totals = this.pool.getTotalStats(); final PoolStats stats = this.pool.getStats(endpoint); buf.append("[total kept alive: ").append(totals.getAvailable()).append("; "); buf.append("address allocated: ").append(stats.getLeased() + stats.getAvailable()); buf.append(" of ").append(stats.getMax()).append("; "); buf.append("total allocated: ").append(totals.getLeased() + totals.getAvailable()); buf.append(" of ").append(totals.getMax()).append("]"); return buf.toString(); }
From source file:org.openrepose.core.services.httpclient.impl.HttpConnectionPoolServiceImpl.java
@Override public HttpClientResponse getClient(String clientId) throws HttpClientNotFoundException { if (poolMap.isEmpty()) { defaultClientId = DEFAULT_POOL_ID; HttpClient httpClient = clientGenerator(DEFAULT_POOL); poolMap.put(defaultClientId, httpClient); }// w ww . ja v a2s .c o m if (clientId != null && !clientId.isEmpty() && !isAvailable(clientId)) { HttpClient httpClient = clientGenerator(DEFAULT_POOL); poolMap.put(clientId, httpClient); } final HttpClient requestedClient; if (clientId == null || clientId.isEmpty()) { requestedClient = poolMap.get(defaultClientId); } else { if (isAvailable(clientId)) { requestedClient = poolMap.get(clientId); } else { throw new HttpClientNotFoundException("Pool " + clientId + "not available"); } } String clientInstanceId = requestedClient.getParams().getParameter(CLIENT_INSTANCE_ID).toString(); String userId = httpClientUserManager.addUser(clientInstanceId); PoolStats poolStats = ((PoolingClientConnectionManager) requestedClient.getConnectionManager()) .getTotalStats(); LOG.trace("Client requested, pool currently leased: {}, available: {}, pending: {}, max: {}", poolStats.getLeased(), poolStats.getAvailable(), poolStats.getPending(), poolStats.getMax()); return new HttpClientResponseImpl(requestedClient, clientId, clientInstanceId, userId); }
From source file:org.apache.http.impl.conn.FixedPoolingClientConnectionManager.java
private String formatStats(final HttpRoute route) { StringBuilder buf = new StringBuilder(); PoolStats totals = this.pool.getTotalStats(); PoolStats stats = this.pool.getStats(route); buf.append("[total kept alive: ").append(totals.getAvailable()).append("; "); buf.append("route allocated: ").append(stats.getLeased() + stats.getAvailable()); buf.append(" of ").append(stats.getMax()).append("; "); buf.append("total allocated: ").append(totals.getLeased() + totals.getAvailable()); buf.append(" of ").append(totals.getMax()).append("]"); return buf.toString(); }
From source file:org.apache.http.impl.conn.JMeterPoolingClientConnectionManager.java
private String formatStats(final HttpRoute route) { final StringBuilder buf = new StringBuilder(); final PoolStats totals = this.pool.getTotalStats(); final PoolStats stats = this.pool.getStats(route); buf.append("[total kept alive: ").append(totals.getAvailable()).append("; "); buf.append("route allocated: ").append(stats.getLeased() + stats.getAvailable()); buf.append(" of ").append(stats.getMax()).append("; "); buf.append("total allocated: ").append(totals.getLeased() + totals.getAvailable()); buf.append(" of ").append(totals.getMax()).append("]"); return buf.toString(); }