Compare commits
5 Commits
master
...
branch-0.1
Author | SHA1 | Date | |
---|---|---|---|
|
f928519591 | ||
|
1fa270985a | ||
|
cff990a787 | ||
|
2d320a2323 | ||
|
e14773daad |
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
VERSION=1.0
|
||||
VERSION=0.14.1
|
||||
|
||||
if test -f version
|
||||
then
|
||||
|
@ -576,7 +576,7 @@ public class APIClient {
|
||||
if (obj.get(k) instanceof JsonString) {
|
||||
key = obj.getString(k);
|
||||
} else {
|
||||
val = obj.getInt(k);
|
||||
val = obj.getJsonNumber(k).longValue();
|
||||
}
|
||||
}
|
||||
if (val > 0 && !key.equals("")) {
|
||||
@ -692,4 +692,37 @@ public class APIClient {
|
||||
public long[] getEstimatedHistogramAsLongArrValue(String string) {
|
||||
return getEstimatedHistogramAsLongArrValue(string, null);
|
||||
}
|
||||
|
||||
public Map<String, Double> getMapStringDouble(String string,
|
||||
MultivaluedMap<String, String> queryParams) {
|
||||
if (string.equals("")) {
|
||||
return null;
|
||||
}
|
||||
JsonReader reader = getReader(string, queryParams);
|
||||
JsonArray arr = reader.readArray();
|
||||
Map<String, Double> map = new HashMap<String, Double>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JsonObject obj = arr.getJsonObject(i);
|
||||
Iterator<String> it = obj.keySet().iterator();
|
||||
String key = "";
|
||||
double val = -1;
|
||||
while (it.hasNext()) {
|
||||
String k = it.next();
|
||||
if (obj.get(k) instanceof JsonString) {
|
||||
key = obj.getString(k);
|
||||
} else {
|
||||
val = obj.getJsonNumber(k).doubleValue();
|
||||
}
|
||||
}
|
||||
if (!key.equals("")) {
|
||||
map.put(key, val);
|
||||
}
|
||||
|
||||
}
|
||||
reader.close();
|
||||
return map;
|
||||
}
|
||||
public Map<String, Double> getMapStringDouble(String string) {
|
||||
return getMapStringDouble(string, null);
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user