Java 类org.apache.http.pool.ConnPoolControl 实例源码

项目:aws-sdk-java-v2    文件:ClientConnectionManagerFactory.java   
/**
 * Returns a wrapped instance of {@link HttpClientConnectionManager}
 * to capture the necessary performance metrics.
 *
 * @param orig the target instance to be wrapped
 */
public static HttpClientConnectionManager wrap(HttpClientConnectionManager orig) {
    if (orig instanceof Wrapped) {
        throw new IllegalArgumentException();
    }
    final Class<?>[] interfaces;
    if (orig instanceof ConnPoolControl) {
        interfaces = new Class<?>[]{
                HttpClientConnectionManager.class,
                ConnPoolControl.class,
                Wrapped.class};
    } else {
        interfaces = new Class<?>[]{
                HttpClientConnectionManager.class,
                Wrapped.class
        };
    }
    return (HttpClientConnectionManager) Proxy.newProxyInstance(
            // https://github.com/aws/aws-sdk-java/pull/48#issuecomment-29454423
            ClientConnectionManagerFactory.class.getClassLoader(),
            interfaces,
            new Handler(orig));
}
项目:ibm-cos-sdk-java    文件:ClientConnectionManagerFactory.java   
/**
 * Returns a wrapped instance of {@link HttpClientConnectionManager}
 * to capture the necessary performance metrics.
 *
 * @param orig the target instance to be wrapped
 */
public static HttpClientConnectionManager wrap
(HttpClientConnectionManager orig) {
    if (orig instanceof Wrapped)
        throw new IllegalArgumentException();
    final Class<?>[] interfaces;
    if (orig instanceof ConnPoolControl) {
        interfaces = new Class<?>[]{
                HttpClientConnectionManager.class,
                ConnPoolControl.class,
                Wrapped.class
        };
    } else {
        interfaces = new Class<?>[]{
                HttpClientConnectionManager.class,
                Wrapped.class
        };
    }
    return (HttpClientConnectionManager) Proxy.newProxyInstance(
            // https://github.com/aws/aws-sdk-java/pull/48#issuecomment-29454423
            ClientConnectionManagerFactory.class.getClassLoader(),
            interfaces,
            new Handler(orig));
}
项目:ibm-cos-sdk-java    文件:DummySuccessfulResponseServerIntegrationTests.java   
/**
 * Tests that a streaming operation has it's request properly cleaned up if the client is interrupted after the
 * response is received.
 *
 * @see TT0070103230
 */
@Test
public void clientInterruptedDuringResponseHandlers_DoesNotLeakConnection() throws IOException {
    ClientConfiguration config = new ClientConfiguration();
    ConnectionManagerAwareHttpClient rawHttpClient = new ApacheHttpClientFactory().create(HttpClientSettings.adapt(config));

    httpClient = new AmazonHttpClient(config, rawHttpClient, null);

    interruptCurrentThreadAfterDelay(1000);
    List<RequestHandler2> requestHandlers = RequestHandlerTestUtils
            .buildRequestHandlerList(new SlowRequestHandler().withAfterResponseWaitInSeconds(10));
    try {
        requestBuilder().executionContext(withHandlers(requestHandlers)).execute(new DummyResponseHandler().leaveConnectionOpen());
        fail("Expected exception");
    } catch (AmazonClientException e) {
        assertThat(e.getCause(), instanceOf(InterruptedException.class));
    }

    @SuppressWarnings("deprecation")
    int leasedConnections = ((ConnPoolControl<?>) ((SdkHttpClient)rawHttpClient).getHttpClientConnectionManager()).getTotalStats().getLeased();
    assertEquals(0, leasedConnections);
}
项目:jira-dvcs-connector    文件:SystemUtils.java   
public static AbstractHttpClient createHttpClient()
{
    try
    {
        if (IS_HTTP_CLIENT_GE_4_2)
        {
            ClientConnectionManager poolingManager = (ClientConnectionManager) Class.forName(
                    "org.apache.http.impl.conn.PoolingClientConnectionManager").newInstance();
            ((ConnPoolControl<?>) poolingManager).setMaxTotal(DEFAULT_MAX_TOTAL);
            ((ConnPoolControl<?>) poolingManager).setDefaultMaxPerRoute(DEFAULT_MAX_PER_ROUTE);
            return new DefaultHttpClient(poolingManager, (HttpParams) null);
        } else {
            return new ThreadSafeHttpClient();
        }
    }
    catch (Exception e)
    {
        throw new IllegalStateException("Can not create http client.", e);
    }
}
项目:routing-bird    文件:ApacheHttpClient441BackedHttpClient.java   
public ApacheHttpClient441BackedHttpClient(String scheme,
    String host,
    int port,
    OAuthSigner signer,
    CloseableHttpClient client,
    Closeable onClose,
    ConnPoolControl<HttpRoute> connPoolControl,
    Map<String, String> headersForEveryRequest) {
    this.scheme = scheme;
    this.host = host;
    this.port = port;

    this.oauthSigner = signer;
    this.client = client;
    this.onClose = onClose;
    this.connPoolControl = connPoolControl;
    this.headersForEveryRequest = headersForEveryRequest;
}
项目:ibm-cos-sdk-java    文件:AmazonHttpClient.java   
/**
 * Captures the connection pool metrics.
 */
private void captureConnectionPoolMetrics() {
    if (awsRequestMetrics.isEnabled() &&
        httpClient.getHttpClientConnectionManager() instanceof
                ConnPoolControl<?>) {
        final PoolStats stats = ((ConnPoolControl<?>) httpClient
                .getHttpClientConnectionManager()).getTotalStats();

        awsRequestMetrics
                .withCounter(HttpClientPoolAvailableCount, stats.getAvailable())
                .withCounter(HttpClientPoolLeasedCount, stats.getLeased())
                .withCounter(HttpClientPoolPendingCount, stats.getPending());
    }

}
项目:lams    文件:AIMDBackoffManager.java   
AIMDBackoffManager(ConnPoolControl<HttpRoute> connPerRoute, Clock clock) {
    this.clock = clock;
    this.connPerRoute = connPerRoute;
    this.lastRouteProbes = new HashMap<HttpRoute,Long>();
    this.lastRouteBackoffs = new HashMap<HttpRoute,Long>();
}
项目:java-restclient    文件:HTTPCAsyncClientMonitor.java   
public HTTPCAsyncClientMonitor(String poolName, ConnPoolControl<HttpRoute> pool) {
    super(poolName, pool);
}
项目:java-restclient    文件:HTTPCClientMonitor.java   
public HTTPCClientMonitor(String poolName, ConnPoolControl<HttpRoute> pool) {
    this.poolName = poolName;
    this.pool = pool;

    this.future = HTTPCClientMonitorExecutor.pool.scheduleAtFixedRate(this, 5, 30, TimeUnit.SECONDS);
}
项目:java-restclient    文件:HTTPCSyncClientMonitor.java   
public HTTPCSyncClientMonitor(String poolName, ConnPoolControl<HttpRoute> pool) {
    super(poolName, pool);
}
项目:remote-files-sync    文件:AIMDBackoffManager.java   
AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute, final Clock clock) {
    this.clock = clock;
    this.connPerRoute = connPerRoute;
    this.lastRouteProbes = new HashMap<HttpRoute,Long>();
    this.lastRouteBackoffs = new HashMap<HttpRoute,Long>();
}
项目:purecloud-iot    文件:AIMDBackoffManager.java   
AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute, final Clock clock) {
    this.clock = clock;
    this.connPerRoute = connPerRoute;
    this.lastRouteProbes = new HashMap<HttpRoute,Long>();
    this.lastRouteBackoffs = new HashMap<HttpRoute,Long>();
}
项目:Visit    文件:AIMDBackoffManager.java   
AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute, final Clock clock) {
    this.clock = clock;
    this.connPerRoute = connPerRoute;
    this.lastRouteProbes = new HashMap<HttpRoute,Long>();
    this.lastRouteBackoffs = new HashMap<HttpRoute,Long>();
}
项目:ZTLib    文件:AIMDBackoffManager.java   
AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute, final Clock clock) {
    this.clock = clock;
    this.connPerRoute = connPerRoute;
    this.lastRouteProbes = new HashMap<HttpRoute,Long>();
    this.lastRouteBackoffs = new HashMap<HttpRoute,Long>();
}
项目:lams    文件:AIMDBackoffManager.java   
/**
 * Creates an <code>AIMDBackoffManager</code> to manage
 * per-host connection pool sizes represented by the
 * given {@link ConnPoolControl}.
 * @param connPerRoute per-host routing maximums to
 *   be managed
 */
public AIMDBackoffManager(ConnPoolControl<HttpRoute> connPerRoute) {
    this(connPerRoute, new SystemClock());
}
项目:remote-files-sync    文件:AIMDBackoffManager.java   
/**
 * Creates an <code>AIMDBackoffManager</code> to manage
 * per-host connection pool sizes represented by the
 * given {@link ConnPoolControl}.
 * @param connPerRoute per-host routing maximums to
 *   be managed
 */
public AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute) {
    this(connPerRoute, new SystemClock());
}
项目:purecloud-iot    文件:AIMDBackoffManager.java   
/**
 * Creates an {@code AIMDBackoffManager} to manage
 * per-host connection pool sizes represented by the
 * given {@link ConnPoolControl}.
 * @param connPerRoute per-host routing maximums to
 *   be managed
 */
public AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute) {
    this(connPerRoute, new SystemClock());
}
项目:Visit    文件:AIMDBackoffManager.java   
/**
 * Creates an <code>AIMDBackoffManager</code> to manage
 * per-host connection pool sizes represented by the
 * given {@link ConnPoolControl}.
 * @param connPerRoute per-host routing maximums to
 *   be managed
 */
public AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute) {
    this(connPerRoute, new SystemClock());
}
项目:cleverbus    文件:CloseableHttpComponentsMessageSender.java   
/**
 * Gets the {@link ConnPoolControl}.
 *
 * @return the {@link ConnPoolControl}
 */
public ConnPoolControl getConnPoolControl() {
    return connPoolControl;
}
项目:ZTLib    文件:AIMDBackoffManager.java   
/**
 * Creates an <code>AIMDBackoffManager</code> to manage
 * per-host connection pool sizes represented by the
 * given {@link ConnPoolControl}.
 * @param connPerRoute per-host routing maximums to
 *   be managed
 */
public AIMDBackoffManager(final ConnPoolControl<HttpRoute> connPerRoute) {
    this(connPerRoute, new SystemClock());
}