test_class.declarator: autoKeeperCollector
test_class.modifier: @SpringBeanByName
      private
test_class.original_string: @SpringBeanByName
      private AutoKeeperCollector   autoKeeperCollector;
test_class.type: AutoKeeperCollector
test_class.var_name: autoKeeperCollector
test_class.declarator: autoKeeperStatService
test_class.modifier: @SpringBeanByName
      private
test_class.original_string: @SpringBeanByName
      private AutoKeeperStatService autoKeeperStatService;
test_class.type: AutoKeeperStatService
test_class.var_name: autoKeeperStatService
test_class.declarator: ADDRESS = "127.0.0.1:2181"
test_class.modifier: private final static
test_class.original_string: private final static String   ADDRESS = "127.0.0.1:2181";
test_class.type: String
test_class.var_name: ADDRESS
test_class.file: manager/biz/src/test/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollectorTest.java
test_class.identifier: AutoKeeperCollectorTest
test_class.superclass: extends BaseOtterTest
test_case.body: @Test
      public void testCollectorServerStat() {
          autoKeeperCollector.collectorServerStat(ADDRESS);
          autoKeeperCollector.collectorConnectionStat(ADDRESS);
          autoKeeperCollector.collectorWatchStat(ADDRESS);
          autoKeeperCollector.collectorEphemeralStat(ADDRESS);
          AutoKeeperServerStat stat = autoKeeperStatService.findServerStat(ADDRESS);
          Set<AutoKeeperConnectionStat> conns = stat.getConnectionStats();
          for (AutoKeeperConnectionStat autoKeeperConnectionStat : conns) {
              autoKeeperStatService.findConnectionBySessionId(autoKeeperConnectionStat.getSessionId());
              autoKeeperStatService.findServerStatBySessionId(autoKeeperConnectionStat.getSessionId());
              String path = autoKeeperConnectionStat.getClientAddress();
              System.out.println(path);
          }
      }
test_case.class_method_signature: AutoKeeperCollectorTest.testCollectorServerStat()
test_case.full_signature: @Test public void testCollectorServerStat()
test_case.identifier: testCollectorServerStat
test_case.invocations: collectorServerStat collectorConnectionStat collectorWatchStat collectorEphemeralStat findServerStat getConnectionStats findConnectionBySessionId getSessionId findServerStatBySessionId getSessionId getClientAddress println
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCollectorServerStat()
focal_class.declarator: autoKeeperClusterService
focal_class.modifier: @Resource(name = "autoKeeperClusterService")
      private
focal_class.original_string: @Resource(name = "autoKeeperClusterService")
      private AutoKeeperClusterService autoKeeperClusterService;
focal_class.type: AutoKeeperClusterService
focal_class.var_name: autoKeeperClusterService
focal_class.declarator: MODE_FOLLOWER            = "Mode: follower"
focal_class.modifier: private static final
focal_class.original_string: private static final String      MODE_FOLLOWER            = "Mode: follower";
focal_class.type: String
focal_class.var_name: MODE_FOLLOWER
focal_class.declarator: MODE_LEADERER            = "Mode: leader"
focal_class.modifier: private static final
focal_class.original_string: private static final String      MODE_LEADERER            = "Mode: leader";
focal_class.type: String
focal_class.var_name: MODE_LEADERER
focal_class.declarator: MODE_OBSERVER            = "Mode: observer"
focal_class.modifier: private static final
focal_class.original_string: private static final String      MODE_OBSERVER            = "Mode: observer";
focal_class.type: String
focal_class.var_name: MODE_OBSERVER
focal_class.declarator: MODE_STANDALONE          = "Mode: standalone"
focal_class.modifier: private static final
focal_class.original_string: private static final String      MODE_STANDALONE          = "Mode: standalone";
focal_class.type: String
focal_class.var_name: MODE_STANDALONE
focal_class.declarator: NODE_COUNT               = "Node count:"
focal_class.modifier: private static final
focal_class.original_string: private static final String      NODE_COUNT               = "Node count:";
focal_class.type: String
focal_class.var_name: NODE_COUNT
focal_class.declarator: STRING_LATENCY           = "Latency min/avg/max:"
focal_class.modifier: private static final
focal_class.original_string: private static final String      STRING_LATENCY           = "Latency min/avg/max:";
focal_class.type: String
focal_class.var_name: STRING_LATENCY
focal_class.declarator: STRING_SENT              = "Sent:"
focal_class.modifier: private static final
focal_class.original_string: private static final String      STRING_SENT              = "Sent:";
focal_class.type: String
focal_class.var_name: STRING_SENT
focal_class.declarator: STRING_RECEIVED          = "Received:"
focal_class.modifier: private static final
focal_class.original_string: private static final String      STRING_RECEIVED          = "Received:";
focal_class.type: String
focal_class.var_name: STRING_RECEIVED
focal_class.declarator: STRING_OUTSTANDING       = "Outstanding:"
focal_class.modifier: private static final
focal_class.original_string: private static final String      STRING_OUTSTANDING       = "Outstanding:";
focal_class.type: String
focal_class.var_name: STRING_OUTSTANDING
focal_class.declarator: COMMA                    = ","
focal_class.modifier: private static final
focal_class.original_string: private static final String      COMMA                    = ",";
focal_class.type: String
focal_class.var_name: COMMA
focal_class.declarator: BRACKETS                 = ")"
focal_class.modifier: private static final
focal_class.original_string: private static final String      BRACKETS                 = ")";
focal_class.type: String
focal_class.var_name: BRACKETS
focal_class.declarator: COLON                    = ":"
focal_class.modifier: private static final
focal_class.original_string: private static final String      COLON                    = ":";
focal_class.type: String
focal_class.var_name: COLON
focal_class.declarator: WRAP                     = "\n"
focal_class.modifier: private static final
focal_class.original_string: private static final String      WRAP                     = "\n";
focal_class.type: String
focal_class.var_name: WRAP
focal_class.declarator: CMD_STAT                 = "echo stat | nc %s %s"
focal_class.modifier: private static final
focal_class.original_string: private static final String      CMD_STAT                 = "echo stat | nc %s %s";
focal_class.type: String
focal_class.var_name: CMD_STAT
focal_class.declarator: CMD_CONS                 = "echo cons | nc %s %s"
focal_class.modifier: private static final
focal_class.original_string: private static final String      CMD_CONS                 = "echo cons | nc %s %s";
focal_class.type: String
focal_class.var_name: CMD_CONS
focal_class.declarator: CMD_DUMP                 = "echo dump | nc %s %s"
focal_class.modifier: private static final
focal_class.original_string: private static final String      CMD_DUMP                 = "echo dump | nc %s %s";
focal_class.type: String
focal_class.var_name: CMD_DUMP
focal_class.declarator: CMD_WCHC                 = "echo wchc | nc %s %s"
focal_class.modifier: private static final
focal_class.original_string: private static final String      CMD_WCHC                 = "echo wchc | nc %s %s";
focal_class.type: String
focal_class.var_name: CMD_WCHC
focal_class.declarator: DEFAULT_COLLECT_INTERVAL = 300
focal_class.modifier: private static final
focal_class.original_string: private static final long        DEFAULT_COLLECT_INTERVAL = 300;
focal_class.type: long
focal_class.var_name: DEFAULT_COLLECT_INTERVAL
focal_class.declarator: delay                    = 1
focal_class.modifier: private
focal_class.original_string: private long                     delay                    = 1;
focal_class.type: long
focal_class.var_name: delay
focal_class.declarator: singleSize               = 1
focal_class.modifier: private
focal_class.original_string: private int                      singleSize               = 1;
focal_class.type: int
focal_class.var_name: singleSize
focal_class.declarator: collectInterval          = DEFAULT_COLLECT_INTERVAL
focal_class.modifier: private
focal_class.original_string: private long                     collectInterval          = DEFAULT_COLLECT_INTERVAL;
focal_class.type: long
focal_class.var_name: collectInterval
focal_class.declarator: autoKeeperData
focal_class.modifier: private
focal_class.original_string: private AutoKeeperData           autoKeeperData;
focal_class.type: AutoKeeperData
focal_class.var_name: autoKeeperData
focal_class.declarator: collectorExecutor
focal_class.modifier: private
focal_class.original_string: private ScheduledExecutorService collectorExecutor;
focal_class.type: ScheduledExecutorService
focal_class.var_name: collectorExecutor
focal_class.file: manager/biz/src/main/java/com/alibaba/otter/manager/biz/autokeeper/impl/AutoKeeperCollector.java
focal_class.identifier: AutoKeeperCollector
focal_class.interfaces: implements InitializingBean
focal_class.class_method_signature: AutoKeeperCollector.collectorConnectionStat(String address)
focal_class.full_signature: public void collectorConnectionStat(String address)
focal_class.identifier: collectorConnectionStat
focal_class.modifiers: public
focal_class.parameters: (String address)
focal_class.return: void
focal_class.signature: void collectorConnectionStat(String address)
focal_class.class_method_signature: AutoKeeperCollector.collectorServerStat(String address)
focal_class.full_signature: public void collectorServerStat(String address)
focal_class.identifier: collectorServerStat
focal_class.modifiers: public
focal_class.parameters: (String address)
focal_class.return: void
focal_class.signature: void collectorServerStat(String address)
focal_class.class_method_signature: AutoKeeperCollector.collectorEphemeralStat(String address)
focal_class.full_signature: public void collectorEphemeralStat(String address)
focal_class.identifier: collectorEphemeralStat
focal_class.modifiers: public
focal_class.parameters: (String address)
focal_class.return: void
focal_class.signature: void collectorEphemeralStat(String address)
focal_class.class_method_signature: AutoKeeperCollector.collectorWatchStat(String address)
focal_class.full_signature: public void collectorWatchStat(String address)
focal_class.identifier: collectorWatchStat
focal_class.modifiers: public
focal_class.parameters: (String address)
focal_class.return: void
focal_class.signature: void collectorWatchStat(String address)
focal_class.class_method_signature: AutoKeeperCollector.collector(String[] command)
focal_class.full_signature: public static String collector(String[] command)
focal_class.identifier: collector
focal_class.modifiers: public static
focal_class.parameters: (String[] command)
focal_class.return: String
focal_class.signature: String collector(String[] command)
focal_class.class_method_signature: AutoKeeperCollector.splitAddress(String address)
focal_class.full_signature: private List<String> splitAddress(String address)
focal_class.identifier: splitAddress
focal_class.modifiers: private
focal_class.parameters: (String address)
focal_class.return: List<String>
focal_class.signature: List<String> splitAddress(String address)
focal_class.class_method_signature: AutoKeeperCollector.groupSessionPath(String cmdresult)
focal_class.full_signature: private Map<String, List<String>> groupSessionPath(String cmdresult)
focal_class.identifier: groupSessionPath
focal_class.modifiers: private
focal_class.parameters: (String cmdresult)
focal_class.return: Map<String, List<String>>
focal_class.signature: Map<String, List<String>> groupSessionPath(String cmdresult)
focal_class.class_method_signature: AutoKeeperCollector.afterPropertiesSet()
focal_class.full_signature: @Override public void afterPropertiesSet()
focal_class.identifier: afterPropertiesSet
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void afterPropertiesSet()
focal_class.class_method_signature: AutoKeeperCollector.startCollect()
focal_class.full_signature: private void startCollect()
focal_class.identifier: startCollect
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void startCollect()
focal_class.class_method_signature: AutoKeeperCollector.setAutoKeeperClusterService(AutoKeeperClusterService autoKeeperClusterService)
focal_class.full_signature: public void setAutoKeeperClusterService(AutoKeeperClusterService autoKeeperClusterService)
focal_class.identifier: setAutoKeeperClusterService
focal_class.modifiers: public
focal_class.parameters: (AutoKeeperClusterService autoKeeperClusterService)
focal_class.return: void
focal_class.signature: void setAutoKeeperClusterService(AutoKeeperClusterService autoKeeperClusterService)
focal_class.class_method_signature: AutoKeeperCollector.setAutoKeeperData(AutoKeeperData autoKeeperData)
focal_class.full_signature: public void setAutoKeeperData(AutoKeeperData autoKeeperData)
focal_class.identifier: setAutoKeeperData
focal_class.modifiers: public
focal_class.parameters: (AutoKeeperData autoKeeperData)
focal_class.return: void
focal_class.signature: void setAutoKeeperData(AutoKeeperData autoKeeperData)
focal_class.class_method_signature: AutoKeeperCollector.setCollectInterval(long collectInterval)
focal_class.full_signature: public void setCollectInterval(long collectInterval)
focal_class.identifier: setCollectInterval
focal_class.modifiers: public
focal_class.parameters: (long collectInterval)
focal_class.return: void
focal_class.signature: void setCollectInterval(long collectInterval)
focal_method.body: public void collectorServerStat(String address) {
          List<String> netAddress = splitAddress(address);
          if (netAddress.isEmpty()) {
              return;
          }
          String ip = netAddress.get(0);
          String port = netAddress.get(1);
          String[] cmd = { "/bin/bash", "-c", String.format(CMD_STAT, ip, port) };
          String cmdresult = collector(cmd);
          String[] result = cmdresult.split(WRAP);
          AutoKeeperServerStat summary = new AutoKeeperServerStat();
          summary.setOriginalContent(cmdresult);
          for (String line : result) {
  
              if (line.contains(MODE_FOLLOWER)) {
                  summary.setQuorumType(AutoKeeperQuorumType.FOLLOWER);
              } else if (line.contains(MODE_LEADERER)) {
                  summary.setQuorumType(AutoKeeperQuorumType.LEADER);
              } else if (line.contains(MODE_STANDALONE)) {
                  summary.setQuorumType(AutoKeeperQuorumType.STANDALONE);
              } else if (line.contains(MODE_OBSERVER)) {
                  summary.setQuorumType(AutoKeeperQuorumType.OBSERVER);
              } else if (line.contains(STRING_LATENCY)) {
                  List<String> latency = Arrays.asList(StringUtils.trimToEmpty(line.replace(STRING_LATENCY,
                                                                                            StringUtils.EMPTY)).split("/"));
                  summary.setMinLatency(Long.parseLong(latency.get(0)));
                  summary.setAvgLatency(Long.parseLong(latency.get(1)));
                  summary.setMaxLatency(Long.parseLong(latency.get(2)));
              } else if (line.contains(STRING_OUTSTANDING)) {
                  summary.setQueued(Long.parseLong(StringUtils.trimToEmpty(line.replace(STRING_OUTSTANDING,
                                                                                        StringUtils.EMPTY))));
              } else if (line.contains(NODE_COUNT)) {
                  summary.setNodeCount(Long.parseLong(StringUtils.trimToEmpty(line.replace(NODE_COUNT, StringUtils.EMPTY))));
              } else if (line.contains(STRING_SENT)) {
                  summary.setSent(Long.parseLong(StringUtils.trimToEmpty(line.replace(STRING_SENT, StringUtils.EMPTY))));
              } else if (line.contains(STRING_RECEIVED)) {
                  summary.setRecved(Long.parseLong(StringUtils.trimToEmpty(line.replace(STRING_RECEIVED,
                                                                                        StringUtils.EMPTY))));
              }
          }
  
          autoKeeperData.joinServer(address, summary);
      }
focal_method.class_method_signature: AutoKeeperCollector.collectorServerStat(String address)
focal_method.full_signature: public void collectorServerStat(String address)
focal_method.identifier: collectorServerStat
focal_method.invocations: splitAddress isEmpty get get format collector split setOriginalContent contains setQuorumType contains setQuorumType contains setQuorumType contains setQuorumType contains asList split trimToEmpty replace setMinLatency parseLong get setAvgLatency parseLong get setMaxLatency parseLong get contains setQueued parseLong trimToEmpty replace contains setNodeCount parseLong trimToEmpty replace contains setSent parseLong trimToEmpty replace contains setRecved parseLong trimToEmpty replace joinServer
focal_method.modifiers: public
focal_method.parameters: (String address)
focal_method.return: void
focal_method.signature: void collectorServerStat(String address)