コード例 #1
0
 public F.Tuple<Integer, Integer> getClusterThroughput() {
   final Map<Node, NodeThroughputResponse> responses;
   try {
     responses =
         api.path(routes.ThroughputResource().total(), NodeThroughputResponse.class)
             .fromAllNodes()
             .executeOnAll();
   } catch (APIException e) {
     LOG.error("Unable to load cluster throughput", e);
     return F.Tuple(0, 0);
   }
   int t = 0;
   for (Map.Entry<Node, NodeThroughputResponse> entry : responses.entrySet()) {
     if (entry.getValue() == null) {
       LOG.warn("Skipping failed throughput request for node {}", entry.getKey());
       continue;
     }
     t += entry.getValue().throughput;
   }
   return F.Tuple(t, responses.size());
 }