StorageService: Support the update getLoadMap API

The API was modify to return the load map as a map of string to double
instead of formatted string.

This patch change the code to support the udpated API.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This commit is contained in:
Amnon Heiman 2015-12-29 17:43:48 +02:00
parent e0e7dcdb5c
commit ccb474e424

View File

@ -366,15 +366,20 @@ public class StorageService extends NotificationBroadcasterSupport
/** Human-readable load value. Keys are IP addresses. */
public Map<String, String> getLoadMap() {
log(" getLoadMap()");
Map<String, String> load = c.getMapStrValue("/storage_service/load_map");
Map<String, Double> load = getLoadMapAsDouble();
Map<String, String> map = new HashMap<>();
for (Map.Entry<String, String> entry : load.entrySet())
for (Map.Entry<String, Double> entry : load.entrySet())
{
map.put(entry.getKey(), FileUtils.stringifyFileSize(Double.parseDouble(entry.getValue())));
map.put(entry.getKey(), FileUtils.stringifyFileSize(entry.getValue()));
}
return map;
}
public Map<String, Double> getLoadMapAsDouble() {
log(" getLoadMapAsDouble()");
return c.getMapStringDouble("/storage_service/load_map");
}
/**
* Return the generation value for this node.
*