/** * Get the current usage statistics for this node. * * @param localNode * the {@link DiscoveryNode} for this node * @param restActions * whether to include rest action usage in the returned * statistics * @return the {@link NodeUsage} representing the usage statistics for this * node */ public NodeUsage getUsageStats(DiscoveryNode localNode, boolean restActions) { Map<String, Long> restUsageMap; if (restActions) { restUsageMap = new HashMap<>(); handlers.forEach(handler -> { long usageCount = handler.getUsageCount(); if (usageCount > 0) { restUsageMap.put(handler.getName(), usageCount); } }); } else { restUsageMap = null; } return new NodeUsage(localNode, System.currentTimeMillis(), sinceTime, restUsageMap); }
/** * Get the current usage statistics for this node. * * @param localNode * the {@link DiscoveryNode} for this node * @param restActions * whether to include rest action usage in the returned * statistics * @return the {@link NodeUsage} representing the usage statistics for this * node */ public NodeUsage getUsageStats(DiscoveryNode localNode, boolean restActions) { Map<String, Long> restUsageMap; if (restActions) { restUsageMap = new HashMap<>(); handlers.forEach(handler -> { long usageCount = handler.getUsageCount(); if (usageCount > 0) { restUsageMap.put(handler.getName(), usageCount); } }); } else { restUsageMap = null; } return new NodeUsage(localNode, System.currentTimeMillis(), sinceTime, restUsageMap); }
/** * Get the current usage statistics for this node. * * @param localNode * the {@link DiscoveryNode} for this node * @param restActions * whether to include rest action usage in the returned * statistics * @return the {@link NodeUsage} representing the usage statistics for this * node */ public NodeUsage getUsageStats(DiscoveryNode localNode, boolean restActions) { Map<String, Long> restUsageMap; if (restActions) { restUsageMap = new HashMap<>(); handlers.forEach(handler -> { long usageCount = handler.getUsageCount(); if (usageCount > 0) { restUsageMap.put(handler.getName(), usageCount); } }); } else { restUsageMap = null; } return new NodeUsage(localNode, System.currentTimeMillis(), sinceTime, restUsageMap); }