當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。