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