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


Java ChannelGroup.size方法代码示例

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


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

示例1: testMasterSlaveSentinelConnectionCount

import io.netty.channel.group.ChannelGroup; //导入方法依赖的package包/类
@Test
public void testMasterSlaveSentinelConnectionCount() throws Exception {

    ChannelGroup channels = (ChannelGroup) ReflectionTestUtils.getField(sentinelClient, "channels");
    int count = channels.size();

    StatefulRedisMasterSlaveConnection<String, String> connection = MasterSlave.connect(sentinelClient,
            new Utf8StringCodec(), sentinelUri);

    connection.sync().ping();
    connection.setReadFrom(ReadFrom.SLAVE);
    slaveCall(connection);

    assertThat(channels.size()).isEqualTo(count + 2 /* connections */ + 1 /* sentinel connections */);

    connection.close();
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:18,代码来源:MasterSlaveSentinelTest.java

示例2: testMasterSlaveSentinelClosesSentinelConnections

import io.netty.channel.group.ChannelGroup; //导入方法依赖的package包/类
@Test
public void testMasterSlaveSentinelClosesSentinelConnections() throws Exception {

    ChannelGroup channels = (ChannelGroup) ReflectionTestUtils.getField(sentinelClient, "channels");
    int count = channels.size();

    StatefulRedisMasterSlaveConnection<String, String> connection = MasterSlave.connect(sentinelClient,
            new Utf8StringCodec(), sentinelUri);

    connection.sync().ping();
    connection.setReadFrom(ReadFrom.SLAVE);
    slaveCall(connection);
    connection.close();

    assertThat(channels.size()).isEqualTo(count);
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:17,代码来源:MasterSlaveSentinelTest.java

示例3: getNumberOfConnectedClients

import io.netty.channel.group.ChannelGroup; //导入方法依赖的package包/类
private int getNumberOfConnectedClients() {
    final Server server = getComponent(Server.KEY);
    if (server == null) {
        Log.i(TAG, "Container not yet connected.");
        return 0;
    }
    ChannelGroup activeChannels = server.getActiveChannels();
    return activeChannels.size();
}
 
开发者ID:SecureSmartHome,项目名称:SecureSmartHome,代码行数:10,代码来源:MasterMainActivity.java

示例4: closeChannels

import io.netty.channel.group.ChannelGroup; //导入方法依赖的package包/类
public static void closeChannels(ChannelGroup allChannels) {
  if (allChannels.size() > 0) {
    // TODO : allow an option here to control if we need to drain connections and wait instead of
    // killing them all
    try {
      //        log.info("Closing %s open client connections", allChannels.size());
      if (!allChannels.close().await(5, TimeUnit.SECONDS)) {
        //          log.warn("Failed to close all open client connections");
      }
    } catch (InterruptedException e) {
      //        log.warn("Interrupted while closing client connections");
      Thread.currentThread().interrupt();
    }
  }
}
 
开发者ID:xjdr,项目名称:xio,代码行数:16,代码来源:ShutdownUtil.java

示例5: allConnected

import io.netty.channel.group.ChannelGroup; //导入方法依赖的package包/类
private int allConnected() {
  ChannelGroup group = getGroup(ALL);

  return group == null ? 0 : group.size();
}
 
开发者ID:mrstampy,项目名称:gameboot,代码行数:6,代码来源:NettyConnectionRegistry.java


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