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


Java HttpAsyncRequester类代码示例

本文整理汇总了Java中org.apache.http.nio.protocol.HttpAsyncRequester的典型用法代码示例。如果您正苦于以下问题:Java HttpAsyncRequester类的具体用法?Java HttpAsyncRequester怎么用?Java HttpAsyncRequester使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HttpAsyncRequester类属于org.apache.http.nio.protocol包,在下文中一共展示了HttpAsyncRequester类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ProxyRequestHandler

import org.apache.http.nio.protocol.HttpAsyncRequester; //导入依赖的package包/类
public ProxyRequestHandler(
        final HttpHost target,
        final HttpAsyncRequester executor,
        final BasicNIOConnPool connPool) {
    super();
    this.target = target;
    this.executor = executor;
    this.connPool = connPool;
    this.counter = new AtomicLong(1);
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:11,代码来源:NHttpReverseProxy.java

示例2: ProxyRequestConsumer

import org.apache.http.nio.protocol.HttpAsyncRequester; //导入依赖的package包/类
public ProxyRequestConsumer(
        final ProxyHttpExchange httpExchange,
        final HttpAsyncRequester executor,
        final BasicNIOConnPool connPool) {
    super();
    this.httpExchange = httpExchange;
    this.executor = executor;
    this.connPool = connPool;
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:10,代码来源:NHttpReverseProxy.java

示例3: initialize

import org.apache.http.nio.protocol.HttpAsyncRequester; //导入依赖的package包/类
private void initialize() {
	if (initialized.getAndSet(true)) {
		return;
	}
	IOReactorConfig.Builder config = createConfig();
	// params.setParameter(CoreProtocolPNames.USER_AGENT, "jsonrpc4j/1.0");
	final ConnectingIOReactor ioReactor = createIoReactor(config);
	createSslContext();
	int socketBufferSize = Integer.getInteger("com.googlecode.jsonrpc4j.async.socket.buffer", 8 * 1024);
	final ConnectionConfig connectionConfig = ConnectionConfig.custom().setBufferSize(socketBufferSize).build();
	BasicNIOConnFactory nioConnFactory = new BasicNIOConnFactory(sslContext, null, connectionConfig);
	pool = new BasicNIOConnPool(ioReactor, nioConnFactory, Integer.getInteger("com.googlecode.jsonrpc4j.async.connect.timeout", 30000));
	pool.setDefaultMaxPerRoute(Integer.getInteger("com.googlecode.jsonrpc4j.async.max.inflight.route", 500));
	pool.setMaxTotal(Integer.getInteger("com.googlecode.jsonrpc4j.async.max.inflight.total", 500));
	
	Thread t = new Thread(new Runnable() {
		@Override
		public void run() {
			try {
				HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor();
				IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler, sslContext, connectionConfig);
				ioReactor.execute(ioEventDispatch);
			} catch (InterruptedIOException ex) {
				System.err.println("Interrupted");
			} catch (IOException e) {
				System.err.println("I/O error: " + e.getMessage());
			}
		}
	}, "jsonrpc4j HTTP IOReactor");
	
	t.setDaemon(true);
	t.start();
	
	HttpProcessor httpProcessor = new ImmutableHttpProcessor(new RequestContent(), new RequestTargetHost(), new RequestConnControl(), new RequestUserAgent(), new RequestExpectContinue(false));
	requester = new HttpAsyncRequester(httpProcessor, new DefaultConnectionReuseStrategy());
}
 
开发者ID:briandilley,项目名称:jsonrpc4j,代码行数:37,代码来源:JsonRpcHttpAsyncClient.java


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