当前位置: 首页>>代码示例>>Java>>正文


Java ConnPoolControl类代码示例

本文整理汇总了Java中org.apache.http.pool.ConnPoolControl的典型用法代码示例。如果您正苦于以下问题:Java ConnPoolControl类的具体用法?Java ConnPoolControl怎么用?Java ConnPoolControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConnPoolControl类属于org.apache.http.pool包,在下文中一共展示了ConnPoolControl类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: if

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:30,代码来源:ClientConnectionManagerFactory.java

示例2: clientInterruptedDuringResponseHandlers_DoesNotLeakConnection

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:28,代码来源:DummySuccessfulResponseServerIntegrationTests.java

示例3: createHttpClient

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
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);
    }
}
 
开发者ID:edgehosting,项目名称:jira-dvcs-connector,代码行数:21,代码来源:SystemUtils.java

示例4: ApacheHttpClient441BackedHttpClient

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
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;
}
 
开发者ID:jivesoftware,项目名称:routing-bird,代码行数:19,代码来源:ApacheHttpClient441BackedHttpClient.java

示例5: wrap

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:29,代码来源:ClientConnectionManagerFactory.java

示例6: captureConnectionPoolMetrics

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
/**
 * 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());
    }

}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:18,代码来源:AmazonHttpClient.java

示例7: AIMDBackoffManager

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
AIMDBackoffManager(ConnPoolControl<HttpRoute> connPerRoute, Clock clock) {
    this.clock = clock;
    this.connPerRoute = connPerRoute;
    this.lastRouteProbes = new HashMap<HttpRoute,Long>();
    this.lastRouteBackoffs = new HashMap<HttpRoute,Long>();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:AIMDBackoffManager.java

示例8: HTTPCAsyncClientMonitor

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
public HTTPCAsyncClientMonitor(String poolName, ConnPoolControl<HttpRoute> pool) {
    super(poolName, pool);
}
 
开发者ID:mercadolibre,项目名称:java-restclient,代码行数:4,代码来源:HTTPCAsyncClientMonitor.java

示例9: HTTPCClientMonitor

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
public HTTPCClientMonitor(String poolName, ConnPoolControl<HttpRoute> pool) {
    this.poolName = poolName;
    this.pool = pool;

    this.future = HTTPCClientMonitorExecutor.pool.scheduleAtFixedRate(this, 5, 30, TimeUnit.SECONDS);
}
 
开发者ID:mercadolibre,项目名称:java-restclient,代码行数:7,代码来源:HTTPCClientMonitor.java

示例10: HTTPCSyncClientMonitor

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
public HTTPCSyncClientMonitor(String poolName, ConnPoolControl<HttpRoute> pool) {
    super(poolName, pool);
}
 
开发者ID:mercadolibre,项目名称:java-restclient,代码行数:4,代码来源:HTTPCSyncClientMonitor.java

示例11: AIMDBackoffManager

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
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>();
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:7,代码来源:AIMDBackoffManager.java

示例12: getConnPoolControl

import org.apache.http.pool.ConnPoolControl; //导入依赖的package包/类
/**
 * Gets the {@link ConnPoolControl}.
 *
 * @return the {@link ConnPoolControl}
 */
public ConnPoolControl getConnPoolControl() {
    return connPoolControl;
}
 
开发者ID:integram,项目名称:cleverbus,代码行数:9,代码来源:CloseableHttpComponentsMessageSender.java


注:本文中的org.apache.http.pool.ConnPoolControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。