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


Java HttpClientOptions.setKeepAlive方法代码示例

本文整理汇总了Java中io.vertx.core.http.HttpClientOptions.setKeepAlive方法的典型用法代码示例。如果您正苦于以下问题:Java HttpClientOptions.setKeepAlive方法的具体用法?Java HttpClientOptions.setKeepAlive怎么用?Java HttpClientOptions.setKeepAlive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.core.http.HttpClientOptions的用法示例。


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

示例1: createHttpClientOptions

import io.vertx.core.http.HttpClientOptions; //导入方法依赖的package包/类
private static HttpClientOptions createHttpClientOptions() {
  HttpClientOptions httpClientOptions = new HttpClientOptions();
  httpClientOptions.setMaxPoolSize(TransportClientConfig.getConnectionMaxPoolSize());
  httpClientOptions.setIdleTimeout(TransportClientConfig.getConnectionIdleTimeoutInSeconds());
  httpClientOptions.setKeepAlive(TransportClientConfig.getConnectionKeepAlive());

  VertxTLSBuilder.buildHttpClientOptions(SSL_KEY, httpClientOptions);
  return httpClientOptions;
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:10,代码来源:RestTransportClient.java

示例2: initHttpClient

import io.vertx.core.http.HttpClientOptions; //导入方法依赖的package包/类
private void initHttpClient() {
    HttpClientOptions httpClientOptions = new HttpClientOptions();
    httpClientOptions.setKeepAlive(true);
    httpClientOptions.setPipelining(true);
    httpClientOptions.setConnectTimeout(CONNECT_TIMEOUT);
    httpClientOptions.setMaxWebsocketFrameSize(MAX_WEBSOCKET_FRAME_SIZE_IN_BYTES);
    httpClient = vertx.createHttpClient(httpClientOptions);
}
 
开发者ID:ocraft,项目名称:ocraft-s2client,代码行数:9,代码来源:S2ClientVerticle.java

示例3: DefaultRestService

import io.vertx.core.http.HttpClientOptions; //导入方法依赖的package包/类
private DefaultRestService(Builder builder) {
  realm = new Realm(builder.authentication, builder.user, builder.password);
  HttpClientOptions httpClientOptions = new HttpClientOptions();
  httpClientOptions.setDefaultHost(builder.host);
  httpClientOptions.setDefaultPort(builder.port);
  httpClientOptions.setKeepAlive(builder.keepAlive);
  this.httpClient = builder.vertx.createHttpClient(httpClientOptions);
}
 
开发者ID:etourdot,项目名称:vertx-marklogic,代码行数:9,代码来源:DefaultRestService.java

示例4: download

import io.vertx.core.http.HttpClientOptions; //导入方法依赖的package包/类
public Future<Void> download(String target) {

		Future<Void> future = Future.future();

		HttpClientOptions options = new HttpClientOptions();
		options.setKeepAlive(false);
		options.setLogActivity(true);

		HttpClient httpClient = vertx.createHttpClient(options);

		httpClient.get(WORDNET_PORT, WORDNET_HOST, WORDNET_FILE, httpEvent -> {
			// pause the http response till we complete setting up our async file handler
				httpEvent.pause();
				// setup file open handler
				OpenOptions openOptions = new OpenOptions();
				vertx.fileSystem().open(target, openOptions, fileEvent -> {
					if (fileEvent.failed()) {
						fileEvent.cause().printStackTrace();
						return;
					}
					final AsyncFile asynFile = fileEvent.result();
					final Pump downloadPump = Pump.pump(httpEvent, asynFile);
					downloadPump.start();
					// resume the receive operation
						httpEvent.resume();
						httpEvent.endHandler(event -> {
							// close the file
							asynFile.flush().close(closeEvent -> {
							});
							logger.info("Downloaded size = {}", downloadPump.numberPumped());

							future.complete();

						});
					});
			}).exceptionHandler(e -> {
            logger.error("Error while downloading the dictionary!", e);
			future.fail(e);
		}).end();

		return future;
	}
 
开发者ID:bpark,项目名称:chlorophytum-semantics,代码行数:43,代码来源:DownloadService.java

示例5: EventSourceImpl

import io.vertx.core.http.HttpClientOptions; //导入方法依赖的package包/类
public EventSourceImpl(Vertx vertx, HttpClientOptions options) {
	options.setKeepAlive(true);
	this.vertx = vertx;
	this.options = options;
	eventHandlers = new HashMap<>();
}
 
开发者ID:aesteve,项目名称:vertx-sse,代码行数:7,代码来源:EventSourceImpl.java


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