本文整理汇总了Java中com.ning.http.client.AsyncHttpProviderConfig类的典型用法代码示例。如果您正苦于以下问题:Java AsyncHttpProviderConfig类的具体用法?Java AsyncHttpProviderConfig怎么用?Java AsyncHttpProviderConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AsyncHttpProviderConfig类属于com.ning.http.client包,在下文中一共展示了AsyncHttpProviderConfig类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createClientConfig
import com.ning.http.client.AsyncHttpProviderConfig; //导入依赖的package包/类
public static AsyncHttpClientConfig.Builder createClientConfig(Configuration configuration) {
AsyncHttpProviderConfig providerConfig = new NettyAsyncHttpProviderConfig();
// We use nio, instead of having a thread per backend ES server node.
// providerConfig.addProperty(NettyAsyncHttpProviderConfig.USE_BLOCKING_IO,true);
providerConfig.addProperty(NettyAsyncHttpProviderConfig.EXECUTE_ASYNC_CONNECT,false);
AsyncHttpClientConfig.Builder cf = new AsyncHttpClientConfig.Builder();
cf.setAsyncHttpClientProviderConfig(providerConfig);
cf.setIOThreadMultiplier(1);
cf.setCompressionEnabled(configuration.getElasticSearchHttpCompressionEnabled());
cf.setConnectionTimeoutInMs(configuration.getElasticSearchHttpConnectionTimeoutMs());
cf.setFollowRedirects(configuration.getElasticSearchHttpFollowRedirects());
cf.setMaximumConnectionsPerHost(1);
cf.setMaxRequestRetry(configuration.getElasticSearchHttpNoOfRetries());
cf.setAllowPoolingConnection(configuration.getElasticSearchHttpConnectionPoolingEnabled());
cf.setRequestTimeoutInMs(configuration.getElasticSearchHttpRequestTimeoutMs());
return cf;
}
示例2: SimpleAsyncHttpProvider
import com.ning.http.client.AsyncHttpProviderConfig; //导入依赖的package包/类
public SimpleAsyncHttpProvider(AsyncHttpClientConfig config) {
this.config = config;
AsyncHttpProviderConfig<?, ?> providerConfig = config.getAsyncHttpProviderConfig();
if (providerConfig instanceof JDKAsyncHttpProviderConfig) {
configure(JDKAsyncHttpProviderConfig.class.cast(providerConfig));
}
}
示例3: getAsyncHttpProviderConfig
import com.ning.http.client.AsyncHttpProviderConfig; //导入依赖的package包/类
@Override
public AsyncHttpProviderConfig<?, ?> getAsyncHttpProviderConfig() {
return config.getAsyncHttpProviderConfig();
}