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


Java ChannelGroup类代码示例

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


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

示例1: bootstrapNetty

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
/**
 * Bootstraps netty, the server that handles all openflow connections
 */
public void bootstrapNetty() {
	try {
		final ServerBootstrap bootstrap = createServerBootStrap();

		bootstrap.setOption("reuseAddr", true);
		bootstrap.setOption("child.keepAlive", true);
		bootstrap.setOption("child.tcpNoDelay", true);
		bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);

		ChannelPipelineFactory pfact = useSsl ? new OpenflowPipelineFactory(this, floodlightProvider.getTimer(), this, debugCounterService, keyStore, keyStorePassword) :
			new OpenflowPipelineFactory(this, floodlightProvider.getTimer(), this, debugCounterService);

		bootstrap.setPipelineFactory(pfact);
		InetSocketAddress sa = new InetSocketAddress(floodlightProvider.getOFPort());
		final ChannelGroup cg = new DefaultChannelGroup();
		cg.add(bootstrap.bind(sa));

		log.info("Listening for switch connections on {}", sa);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:26,代码来源:OFSwitchManager.java

示例2: bootstrapNetty

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
/**
 * Bootstraps netty, the server that handles all openflow connections
 */
public void bootstrapNetty() {
	try {
		final ServerBootstrap bootstrap = createServerBootStrap();

		bootstrap.setOption("reuseAddr", true);
		bootstrap.setOption("child.keepAlive", true);
		bootstrap.setOption("child.tcpNoDelay", true);
		bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);
		
		ChannelPipelineFactory pfact = useSsl ? new OpenflowPipelineFactory(this, floodlightProvider.getTimer(), this, debugCounterService, ofBitmaps, defaultFactory, keyStore, keyStorePassword) :
			new OpenflowPipelineFactory(this, floodlightProvider.getTimer(), this, debugCounterService, ofBitmaps, defaultFactory);
		
		bootstrap.setPipelineFactory(pfact);
		InetSocketAddress sa = new InetSocketAddress(floodlightProvider.getOFPort());
		final ChannelGroup cg = new DefaultChannelGroup();
		cg.add(bootstrap.bind(sa));

		log.info("Listening for switch connections on {}", sa);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:rhoybeen,项目名称:floodlightLB,代码行数:26,代码来源:OFSwitchManager.java

示例3: bootstrapNetty

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
/**
 * Bootstraps netty, the server that handles all openflow connections
 * 启动netty,处理所有OF连接
 */
public void bootstrapNetty() {
	try {
		final ServerBootstrap bootstrap = createServerBootStrap();

		bootstrap.setOption("reuseAddr", true);
		bootstrap.setOption("child.keepAlive", true);
		bootstrap.setOption("child.tcpNoDelay", true);
		bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);

		ChannelPipelineFactory pfact = useSsl ? new OpenflowPipelineFactory(this, floodlightProvider.getTimer(), this, debugCounterService, keyStore, keyStorePassword) :
			new OpenflowPipelineFactory(this, floodlightProvider.getTimer(), this, debugCounterService);

		bootstrap.setPipelineFactory(pfact);
		InetSocketAddress sa = new InetSocketAddress(floodlightProvider.getOFPort());
		final ChannelGroup cg = new DefaultChannelGroup();
		cg.add(bootstrap.bind(sa));

		log.info("Listening for switch connections on {}", sa);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:DaiDongLiang,项目名称:DSC,代码行数:27,代码来源:OFSwitchManager.java

示例4: bootstrapNetty

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
/**
 * Bootstraps netty, the server that handles all openflow connections
 */
public void bootstrapNetty() {
	try {
		final ServerBootstrap bootstrap = createServerBootStrap();

		bootstrap.setOption("reuseAddr", true);
		bootstrap.setOption("child.keepAlive", true);
		bootstrap.setOption("child.tcpNoDelay", true);
		bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);

		ChannelPipelineFactory pfact =
				new OpenflowPipelineFactory(this, floodlightProvider.getTimer(), this, debugCounterService);
		bootstrap.setPipelineFactory(pfact);
		InetSocketAddress sa = new InetSocketAddress(floodlightProvider.getOFPort());
		final ChannelGroup cg = new DefaultChannelGroup();
		cg.add(bootstrap.bind(sa));

		log.info("Listening for switch connections on {}", sa);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:25,代码来源:OFSwitchManager.java

示例5: withoutPacketTest

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
@Test
public void withoutPacketTest() throws Exception {
    ChannelGroup channelGroup = new DefaultChannelGroup();

    HealthCheckManager healthCheckManager = new HealthCheckManager(timer, 3000, channelGroup);
    healthCheckManager.start(1000);

    Channel mockChannel = createMockChannel(HealthCheckState.WAIT);
    channelGroup.add(mockChannel);

    try {
        verify(mockChannel, timeout(5000).atLeastOnce()).close();
    } finally {
        healthCheckManager.stop();
    }
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:17,代码来源:HealthCheckManagerTest.java

示例6: HttpTunnelServerChannel

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
protected HttpTunnelServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, ServerSocketChannelFactory inboundFactory, ChannelGroup realConnections) {
	super(factory, pipeline, sink);

	tunnelIdPrefix = Long.toHexString(random.nextLong());
	tunnels = new ConcurrentHashMap<String, HttpTunnelAcceptedChannel>();

	config = new HttpTunnelServerChannelConfig();
	realChannel = inboundFactory.newChannel(this.createRealPipeline(realConnections));
	config.setRealChannel(realChannel);

	opened = new AtomicBoolean(true);
	bindState = new AtomicReference<BindState>(BindState.UNBOUND);

	realConnections.add(realChannel);

	Channels.fireChannelOpen(this);
}
 
开发者ID:reines,项目名称:httptunnel,代码行数:18,代码来源:HttpTunnelServerChannel.java

示例7: RpcProgramPortmap

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
RpcProgramPortmap(ChannelGroup allChannels) {
  this.allChannels = allChannels;
  PortmapMapping m = new PortmapMapping(PROGRAM, VERSION,
      PortmapMapping.TRANSPORT_TCP, RpcProgram.RPCB_PORT);
  PortmapMapping m1 = new PortmapMapping(PROGRAM, VERSION,
      PortmapMapping.TRANSPORT_UDP, RpcProgram.RPCB_PORT);
  map.put(PortmapMapping.key(m), m);
  map.put(PortmapMapping.key(m1), m1);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:RpcProgramPortmap.java

示例8: NettyIkasoaFactory

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
public NettyIkasoaFactory(NettyServerConfig nettyServerConfig, ChannelGroup channelGroup) {
	this.nettyServerConfig = nettyServerConfig;
	if (channelGroup == null)
		this.channelGroup = new DefaultChannelGroup();
	else
		this.channelGroup = channelGroup;
}
 
开发者ID:venwyhk,项目名称:ikasoa,代码行数:8,代码来源:NettyIkasoaFactory.java

示例9: NettyServerUpstreamHandler

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
public NettyServerUpstreamHandler(LoggerFactory loggerFactory, ChannelHandler channelHandler,
        ChannelGroup channelGroup) {
    this.logger = loggerFactory.create(this);
    this.ioErrorLogger = loggerFactory.create(this.getClass().getSimpleName() + ".IOError");
    this.channelHandler = channelHandler;
    this.allChannels = channelGroup;
}
 
开发者ID:kuiwang,项目名称:my-dev,代码行数:8,代码来源:NettyServerUpstreamHandler.java

示例10: NettyServerTransport

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
@Inject
public NettyServerTransport(final ThriftServerDef def, final NettyServerConfig nettyServerConfig, final ChannelGroup allChannels, final boolean local) {
	this.def = def;
	this.nettyServerConfig = nettyServerConfig;
	this.requestedPort = def.getServerPort();
	this.allChannels = allChannels;
	this.local = local;
	// connectionLimiter must be instantiated exactly once (and thus outside
	// the pipeline factory)
	final ConnectionLimiter connectionLimiter = new ConnectionLimiter(def.getMaxConnections());

	this.channelStatistics = new ChannelStatistics(allChannels);

	this.pipelineFactory = new ChannelPipelineFactory() {
		@Override
		public ChannelPipeline getPipeline() throws Exception {
			ChannelPipeline cp = Channels.pipeline();
			TProtocolFactory inputProtocolFactory = def.getDuplexProtocolFactory().getInputProtocolFactory();
			NiftySecurityHandlers securityHandlers = def.getSecurityFactory().getSecurityHandlers(def, nettyServerConfig);
			cp.addLast("connectionContext", new ConnectionContextHandler());
			cp.addLast("connectionLimiter", connectionLimiter);
			cp.addLast(ChannelStatistics.NAME, channelStatistics);
			cp.addLast("encryptionHandler", securityHandlers.getEncryptionHandler());
			cp.addLast("frameCodec", def.getThriftFrameCodecFactory().create(def.getMaxFrameSize(), inputProtocolFactory));
			if (def.getClientIdleTimeout() != null) {
				// Add handlers to detect idle client connections and
				// disconnect them
				cp.addLast("idleTimeoutHandler", new IdleStateHandler(nettyServerConfig.getTimer(), def.getClientIdleTimeout().toMillis(),
						NO_WRITER_IDLE_TIMEOUT, NO_ALL_IDLE_TIMEOUT, TimeUnit.MILLISECONDS));
				cp.addLast("idleDisconnectHandler", new IdleDisconnectHandler());
			}

			cp.addLast("authHandler", securityHandlers.getAuthenticationHandler());
			cp.addLast("dispatcher", new NiftyDispatcher(def, nettyServerConfig.getTimer()));
			cp.addLast("exceptionLogger", new NiftyExceptionLogger());
			return cp;
		}
	};
}
 
开发者ID:Treydone,项目名称:mandrel,代码行数:40,代码来源:NettyServerTransport.java

示例11: ClientChannelPipeline

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
public ClientChannelPipeline(
        final OpenVirteXController openVirteXController,
        final ChannelGroup cg, final ThreadPoolExecutor pipelineExecutor,
        final ClientBootstrap bootstrap, final OVXSwitch sw) {
    super();
    this.ctrl = openVirteXController;
    this.pipelineExecutor = pipelineExecutor;
    this.timer = PhysicalNetwork.getTimer();
    this.idleHandler = new IdleStateHandler(this.timer, 20, 25, 0);
    this.readTimeoutHandler = new ReadTimeoutHandler(this.timer, 30);
    this.bootstrap = bootstrap;
    this.sw = sw;
    this.cg = cg;
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:15,代码来源:ClientChannelPipeline.java

示例12: ReconnectHandler

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
public ReconnectHandler(final OVXSwitch sw,
        final ClientBootstrap bootstrap, final Timer timer,
        final int maxBackOff, final ChannelGroup cg) {
    super();
    this.sw = sw;
    this.bootstrap = bootstrap;
    this.timer = timer;
    this.maxBackOff = maxBackOff;
    this.cg = cg;

}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:12,代码来源:ReconnectHandler.java

示例13: ChannelPoolLifecycle

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
public ChannelPoolLifecycle(SocketAddress address, ClientBootstrap bootstrap, long getTimeout,
                            ScheduledExecutorService executor, ChannelGroup channelGroup)
{
  _remoteAddress = address;
  _rateLimiter = new RateLimiter(0, getTimeout / 2, Math.max(10, getTimeout / 32), executor);
  _bootstrap = bootstrap;
  _channelGroup = channelGroup;
}
 
开发者ID:ppdai,项目名称:rest4j,代码行数:9,代码来源:ChannelPoolLifecycle.java

示例14: HealthCheckManager

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
public HealthCheckManager(Timer timer, long waitTimeMillis, ChannelGroup channelGroup) {
    Assert.requireNonNull(timer, "timer must not be null");
    Assert.isTrue(waitTimeMillis > 0, "waitTimeMillis is must greater than 0");
    Assert.requireNonNull(channelGroup, "channelGroup must not be null");

    this.timer = timer;
    this.waitTimeMillis = waitTimeMillis;

    this.channelGroup = channelGroup;
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:11,代码来源:HealthCheckManager.java

示例15: legacyPingPacketTest

import org.jboss.netty.channel.group.ChannelGroup; //导入依赖的package包/类
@Test
public void legacyPingPacketTest() throws Exception {
    ChannelGroup channelGroup = new DefaultChannelGroup();

    HealthCheckManager healthCheckManager = new HealthCheckManager(timer, 3000, channelGroup);
    healthCheckManager.start(1000);

    Channel mockChannel = createMockChannel(HealthCheckState.RECEIVED_LEGACY);
    channelGroup.add(mockChannel);
    try {
        verify(mockChannel, timeout(3000).atLeastOnce()).write(PingPacket.PING_PACKET);
    } finally {
        healthCheckManager.stop();
    }
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:16,代码来源:HealthCheckManagerTest.java


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