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


Java ChannelPoolHandler类代码示例

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


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

示例1: BasicMultiNodeConnPoolMock

import io.netty.channel.pool.ChannelPoolHandler; //导入依赖的package包/类
public BasicMultiNodeConnPoolMock(
	final Semaphore concurrencyThrottle, final String[] nodes, final Bootstrap bootstrap,
	final ChannelPoolHandler connPoolHandler, final int defaultPort,
	final int connFailSeqLenLimit
) {
	super(
		concurrencyThrottle, nodes, bootstrap, connPoolHandler, defaultPort,
		connFailSeqLenLimit
	);
}
 
开发者ID:akurilov,项目名称:netty-connection-pool,代码行数:11,代码来源:BasicMultiNodeConnPoolMock.java

示例2: HubManager

import io.netty.channel.pool.ChannelPoolHandler; //导入依赖的package包/类
private HubManager(final Properties properties) {
		Runtime.getRuntime().addShutdownHook(new Thread(){
			public void run() { try { close(); } catch (Exception x) {/* No Op */} }
		});
		log.info(">>>>> Initializing HubManager...");
		metricMetaService = new MetricsMetaAPIImpl(properties);
		tsdbEndpoint = TSDBEndpoint.getEndpoint(metricMetaService.getSqlWorker());
		for(String url: tsdbEndpoint.getUpServers()) {
			final URL tsdbUrl = URLHelper.toURL(url);
			tsdbAddresses.add(new InetSocketAddress(tsdbUrl.getHost(), tsdbUrl.getPort()));
		}
		endpointCount = tsdbAddresses.size(); 
		endpointSequence = new AtomicInteger(endpointCount);
		group = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2, metricMetaService.getForkJoinPool());
		bootstrap = new Bootstrap();
		bootstrap
			.handler(channelInitializer)
			.group(group)
			.channel(NioSocketChannel.class)
			.option(ChannelOption.RCVBUF_ALLOCATOR, new AdaptiveRecvByteBufAllocator())
			.option(ChannelOption.ALLOCATOR, BufferManager.getInstance());
		final ChannelPoolHandler poolHandler = this;
		poolMap = new AbstractChannelPoolMap<InetSocketAddress, SimpleChannelPool>() {
		    @Override
		    protected SimpleChannelPool newPool(final InetSocketAddress key) {
				final Bootstrap b = new Bootstrap().handler(channelInitializer)
				.group(group)
				.remoteAddress(key)
				.channel(NioSocketChannel.class)
				.option(ChannelOption.RCVBUF_ALLOCATOR, new AdaptiveRecvByteBufAllocator())
				.option(ChannelOption.ALLOCATOR, BufferManager.getInstance());		    	
		        return new SimpleChannelPool(b, poolHandler);
		    }
		};
		eventExecutor = new DefaultEventExecutor(metricMetaService.getForkJoinPool());
		channelGroup = new DefaultChannelGroup("MetricHubChannelGroup", eventExecutor);
		
//		tsdbAddresses.parallelStream().forEach(addr -> {
//			final Set<Channel> channels = Collections.synchronizedSet(new HashSet<Channel>(3));
//			IntStream.of(1,2,3).parallel().forEach(i -> {
//				final ChannelPool pool = poolMap.get(addr); 
//				try {channels.add(pool.acquire().awaitUninterruptibly().get());
//				} catch (Exception e) {}
//				log.info("Acquired [{}] Channels", channels.size());
//				channels.parallelStream().forEach(ch -> pool.release(ch));
//			});
//		});
		
		
		
		
		log.info("<<<<< HubManager Initialized.");
	}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:54,代码来源:HubManager.java

示例3: ConnectionlessChannelPool

import io.netty.channel.pool.ChannelPoolHandler; //导入依赖的package包/类
public ConnectionlessChannelPool(Bootstrap bootstrap, ChannelPoolHandler handler) {
    super(bootstrap, handler);
}
 
开发者ID:ribasco,项目名称:async-gamequery-lib,代码行数:4,代码来源:ConnectionlessChannelPool.java

示例4: getChannelPoolHandler

import io.netty.channel.pool.ChannelPoolHandler; //导入依赖的package包/类
/**
 * @return The {@link ChannelPoolHandler}
 */
public ChannelPoolHandler getChannelPoolHandler() {
    return channelPoolHandler;
}
 
开发者ID:ribasco,项目名称:async-gamequery-lib,代码行数:7,代码来源:NettyPooledTransport.java

示例5: newPool

import io.netty.channel.pool.ChannelPoolHandler; //导入依赖的package包/类
ChannelPool newPool(Bootstrap b,
ChannelPoolHandler handler,
ChannelHealthChecker checker);
 
开发者ID:reactor,项目名称:reactor-netty,代码行数:4,代码来源:DefaultPoolResources.java


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