use of com.emc.storageos.coordinator.client.model.CoordinatorSerializable in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method queryRuntimeState.
@Override
public <T extends CoordinatorSerializable> T queryRuntimeState(String key, Class<T> clazz) throws CoordinatorException {
String path = String.format("%s/%s", ZkPath.STATE, key);
try {
byte[] data = _zkConnection.curator().getData().forPath(path);
CoordinatorSerializable state = clazz.newInstance();
return (T) state.decodeFromString(new String(data, "UTF-8"));
} catch (KeeperException.NoNodeException ignore) {
// Ignore exception, don't re-throw
log.debug("Caught exception but ignoring it: " + ignore);
return null;
} catch (Exception e) {
throw CoordinatorException.fatals.unableToFindTheState(key, e);
}
}
Aggregations