本文整理了Java中com.ning.http.client.AsyncHttpClientConfig.getMaxConnections()
方法的一些代码示例,展示了AsyncHttpClientConfig.getMaxConnections()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AsyncHttpClientConfig.getMaxConnections()
方法的具体详情如下:
包路径:com.ning.http.client.AsyncHttpClientConfig
类名称:AsyncHttpClientConfig
方法名:getMaxConnections
[英]Return the maximum number of connections an com.ning.http.client.AsyncHttpClient can handle.
[中]返回com的最大连接数。宁。http。客户AsyncHttpClient可以处理。
代码示例来源:origin: com.ning/async-http-client
if (config.getMaxConnections() > -1 && (maxConnections.get() + 1) > config.getMaxConnections()) {
throw new IOException(String.format("Too many connections %s", config.getMaxConnections()));
代码示例来源:origin: com.ning/async-http-client
tooManyConnections = buildStaticIOException(String.format("Too many connections %s", config.getMaxConnections()));
tooManyConnectionsPerHost = buildStaticIOException(String.format("Too many connections per host %s", config.getMaxConnectionsPerHost()));
poolAlreadyClosed = buildStaticIOException("Pool is already closed");
maxTotalConnectionsEnabled = config.getMaxConnections() > 0;
maxConnectionsPerHostEnabled = config.getMaxConnectionsPerHost() > 0;
freeChannels = new Semaphore(config.getMaxConnections());
} else {
openChannels = new CleanupChannelGroup("asyncHttpClient");
代码示例来源:origin: com.ning/async-http-client
connectionTTL = prototype.getConnectionTTL();
maxRedirects = prototype.getMaxRedirects();
maxConnections = prototype.getMaxConnections();
proxyServerSelector = prototype.getProxyServerSelector();
realm = prototype.getRealm();
代码示例来源:origin: com.ning/async-http-client
fc = handleIoException(fc);
} catch (FilterException e) {
if (config.getMaxConnections() != -1) {
maxConnections.decrementAndGet();
} finally {
if (terminate) {
if (config.getMaxConnections() != -1) {
maxConnections.decrementAndGet();
代码示例来源:origin: com.ning/async-http-client
.connectTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.asyncPollTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.maxConnectionsTotal(config.getMaxConnections())
.maxConnectionsPerEndpoint(config.getMaxConnectionsPerHost())
.keepAliveTimeout(config.getPooledConnectionIdleTimeout(), TimeUnit.MILLISECONDS)
.connectTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.asyncPollTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.maxConnectionsTotal(config.getMaxConnections())
.maxConnectionsPerEndpoint(config.getMaxConnectionsPerHost())
.keepAliveTimeout(0, TimeUnit.MILLISECONDS) // no pool
代码示例来源:origin: io.gatling/async-http-client
public boolean preemptChannel(AsyncHandler<?> asyncHandler, String poolKey) throws IOException {
boolean channelPreempted = false;
if (channelManager.preemptChannel(poolKey)) {
channelPreempted = true;
} else {
IOException ex = new IOException(String.format("Too many connections %s", config.getMaxConnections()));
try {
asyncHandler.onThrowable(ex);
} catch (Exception e) {
LOGGER.warn("asyncHandler.onThrowable crashed", e);
}
throw ex;
}
return channelPreempted;
}
代码示例来源:origin: io.gatling/async-http-client
public GrizzlyConnectionPool(final AsyncHttpClientConfig config) {
cacheSSLConnections = config.isAllowPoolingSslConnections();
timeout = config.getPooledConnectionIdleTimeout();
maxConnectionLifeTime = config.getConnectionTTL();
maxConnectionsPerHost = config.getMaxConnectionsPerHost();
maxConnections = config.getMaxConnections();
unlimitedConnections = (maxConnections == -1);
delayedExecutor = new DelayedExecutor(Executors.newSingleThreadExecutor(), this);
delayedExecutor.start();
ownsDelayedExecutor = true;
}
代码示例来源:origin: io.gatling/async-http-client
if (config.getMaxConnections() > -1 && (maxConnections.get() + 1) > config.getMaxConnections()) {
throw new IOException(String.format("Too many connections %s", config.getMaxConnections()));
代码示例来源:origin: spotify/async-google-pubsub-client
log.debug("read timeout: {}", config.getReadTimeout());
log.debug("request timeout: {}", config.getRequestTimeout());
log.debug("max connections: {}", config.getMaxConnections());
log.debug("max connections per host: {}", config.getMaxConnectionsPerHost());
log.debug("enabled cipher suites: {}", Arrays.toString(config.getEnabledCipherSuites()));
代码示例来源:origin: io.gatling/async-http-client
if (config.getMaxConnections() > -1 && (maxConnections.get() + 1) > config.getMaxConnections()) {
throw new IOException(String.format("Too many connections %s", config.getMaxConnections()));
代码示例来源:origin: io.gatling/async-http-client
maxTotalConnectionsEnabled = config.getMaxConnections() > 0;
maxConnectionsPerHostEnabled = config.getMaxConnectionsPerHost() > 0;
freeChannels = new Semaphore(config.getMaxConnections());
} else {
openChannels = new CleanupChannelGroup("asyncHttpClient");
代码示例来源:origin: io.gatling/async-http-client
ConnectionManager(final GrizzlyAsyncHttpProvider provider,
final TCPNIOTransport transport,
final GrizzlyAsyncHttpProviderConfig providerConfig) {
ConnectionPool connectionPool;
this.provider = provider;
final AsyncHttpClientConfig config = provider.clientConfig;
if (config.isAllowPoolingConnections()) {
ConnectionPool pool = providerConfig != null ? providerConfig.getConnectionPool() : null;
if (pool != null) {
connectionPool = pool;
} else {
connectionPool = new GrizzlyConnectionPool((config));
}
} else {
connectionPool = new NonCachingPool();
}
pool = connectionPool;
connectionHandler = TCPNIOConnectorHandler.builder(transport).build();
final int maxConns = provider.clientConfig.getMaxConnections();
connectionMonitor = new ConnectionMonitor(maxConns);
}
代码示例来源:origin: io.gatling/async-http-client
connectionTTL = prototype.getConnectionTTL();
maxRedirects = prototype.getMaxRedirects();
maxConnections = prototype.getMaxConnections();
proxyServerSelector = prototype.getProxyServerSelector();
realm = prototype.getRealm();
代码示例来源:origin: io.gatling/async-http-client
fc = handleIoException(fc);
} catch (FilterException e) {
if (config.getMaxConnections() != -1) {
maxConnections.decrementAndGet();
if (config.getMaxConnections() != -1) {
maxConnections.decrementAndGet();
代码示例来源:origin: javaee/grizzly-ahc
connectionTTL = prototype.getConnectionTTL();
maxRedirects = prototype.getMaxRedirects();
maxConnections = prototype.getMaxConnections();
proxyServerSelector = prototype.getProxyServerSelector();
realm = prototype.getRealm();
代码示例来源:origin: io.gatling/async-http-client
fc = handleIoException(fc);
} catch (FilterException e) {
if (config.getMaxConnections() != -1) {
maxConnections.decrementAndGet();
if (config.getMaxConnections() != -1) {
maxConnections.decrementAndGet();
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client
connectionTTL = prototype.getConnectionTTL();
maxRedirects = prototype.getMaxRedirects();
maxConnections = prototype.getMaxConnections();
proxyServerSelector = prototype.getProxyServerSelector();
realm = prototype.getRealm();
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-client
.connectTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.asyncPollTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.maxConnectionsTotal(config.getMaxConnections())
.maxConnectionsPerEndpoint(config.getMaxConnectionsPerHost())
.keepAliveTimeout(config.getPooledConnectionIdleTimeout(), TimeUnit.MILLISECONDS)
.connectTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.asyncPollTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.maxConnectionsTotal(config.getMaxConnections())
.maxConnectionsPerEndpoint(config.getMaxConnectionsPerHost())
.keepAliveTimeout(0, TimeUnit.MILLISECONDS) // no pool
代码示例来源:origin: javaee/grizzly-ahc
.connectTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.asyncPollTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.maxConnectionsTotal(config.getMaxConnections())
.maxConnectionsPerEndpoint(config.getMaxConnectionsPerHost())
.keepAliveTimeout(config.getPooledConnectionIdleTimeout(), TimeUnit.MILLISECONDS)
.connectTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.asyncPollTimeout(config.getConnectTimeout(), TimeUnit.MILLISECONDS)
.maxConnectionsTotal(config.getMaxConnections())
.maxConnectionsPerEndpoint(config.getMaxConnectionsPerHost())
.keepAliveTimeout(0, TimeUnit.MILLISECONDS) // no pool
内容来源于网络,如有侵权,请联系作者删除!