當前位置: 首頁>>代碼示例>>Java>>正文


Java ResteasyClientBuilder.connectionPoolSize方法代碼示例

本文整理匯總了Java中org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.connectionPoolSize方法的典型用法代碼示例。如果您正苦於以下問題:Java ResteasyClientBuilder.connectionPoolSize方法的具體用法?Java ResteasyClientBuilder.connectionPoolSize怎麽用?Java ResteasyClientBuilder.connectionPoolSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder的用法示例。


在下文中一共展示了ResteasyClientBuilder.connectionPoolSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的package包/類
@Override
public void start(StartContext startContext) throws StartException {

    Consul.Builder builder = Consul.builder();


    // pool because of multiple threads.
    ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
    clientBuilder = clientBuilder.connectionPoolSize(20);

    builder.withClientBuilder(clientBuilder);
    builder.withUrl(this.url);

    try {
        this.consul = builder.build();
    } catch (Exception e) {
        throw new StartException("Failed to connect consul at " + url, e);
    }
}
 
開發者ID:wildfly-swarm-archive,項目名稱:wildfly-swarm-topology-consul,代碼行數:20,代碼來源:ConsulService.java

示例2: DawPurchasesClient

import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; //導入方法依賴的package包/類
public DawPurchasesClient(boolean useHttps, String hostname, int port) {
    checkNotNull(hostname, "hostname");
    checkArgument(port > 0, "Invalid port %s", port);
    String apiHostUrl = String.format("%s://%s:%d", useHttps ? "https" : "http", hostname, port);

    ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder();
    clientBuilder.establishConnectionTimeout(GLOBAL_TIMEOUT, TimeUnit.MILLISECONDS);
    clientBuilder.socketTimeout(GLOBAL_TIMEOUT, TimeUnit.MILLISECONDS);
    clientBuilder.maxPooledPerRoute(GLOBAL_MAX_CONNS);
    clientBuilder.connectionPoolSize(GLOBAL_MAX_CONNS);
    clientBuilder.connectionTTL(CONNECTION_TTL, TimeUnit.MILLISECONDS);
    clientBuilder.connectionCheckoutTimeout(GET_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);

    jaxRsClient = clientBuilder.build();
    ResteasyWebTarget target = jaxRsClient.target(apiHostUrl);

    // TODO: potential improvements here:
    //   - Avoid "useHttps" boolean parameter - enum instead

    apiClientProxy = target.proxy(ApiSpec.class);
}
 
開發者ID:MiguelGL,項目名稱:popular-purchases-demo,代碼行數:22,代碼來源:DawPurchasesClient.java


注:本文中的org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.connectionPoolSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。