StorageService: Add the effectiveOwnership and getOwnership implementation

This adds the implementation of the effectiveOwnership and getOwnership
in StorageService. It uses the API that defined in storage_service.json.

After this patch the effectiveOwnership and getOwnership will be
available via jconsole.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This commit is contained in:
Amnon Heiman 2015-08-24 10:35:05 +03:00
parent 7e7e0ca367
commit b53be3a4ec

View File

@ -735,8 +735,7 @@ public class StorageService extends NotificationBroadcasterSupport
*/
public Map<InetAddress, Float> getOwnership() {
log(" getOwnership()");
// TBD
return c.getMapInetAddressFloatValue("");
return c.getMapInetAddressFloatValue("/storage_service/ownership/");
}
/**
@ -749,8 +748,11 @@ public class StorageService extends NotificationBroadcasterSupport
public Map<InetAddress, Float> effectiveOwnership(String keyspace)
throws IllegalStateException {
log(" effectiveOwnership(String keyspace) throws IllegalStateException");
// TBD
return c.getMapInetAddressFloatValue("");
try {
return c.getMapInetAddressFloatValue("/storage_service/ownership/" + keyspace);
} catch (Exception e) {
throw new IllegalStateException("Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless");
}
}
public List<String> getKeyspaces() {