开发者社区> 问答> 正文

使用JaxRsClientFactory创建代理时,如何设置连接池大小/最大连接数?

我正在使用JaxRSClientFactory为我的API创建代理客户端。代码如下:

final MyApi api = JAXRSClientFactory.create(url, MyApi.class,
            Collections.singletonList(new JacksonJaxbJsonProvider(new ObjectMapper(), new Annotations[] {Annotations.JACKSON})) )
    ;

    WebClient.client( api ).header( "Authorization", auth ).header("User-Agent", "MyService");
    WebClient.getConfig( api ).getHttpConduit().getClient().setReceiveTimeout( readTimeout );
    WebClient.getConfig( api ).getHttpConduit().getClient().setConnectionTimeout(connectTimeout);
    WebClient.getConfig( api ).getHttpConduit().getClient().setConnection( ConnectionType.KEEP_ALIVE);
    WebClient.client( api ).accept( MediaType.APPLICATION_JSON_TYPE );
    WebClient.client( api ).type( MediaType.APPLICATION_JSON_TYPE );

如何设置连接池大小或此处允许的最大连接数?我在网上找到了Jersey RestEasyClient的样本,但没有找到任何用于Client构建的样本JAXRSClientFactory。

有人对此有任何想法吗?

展开
收起
垚tutu 2019-11-28 18:23:01 810 0
0 条回答
写回答
取消 提交回答
问答分类:
API
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载