use of mousio.etcd4j.responses.EtcdKeysResponse in project camel by apache.
the class EtcdRoutePolicy method tryTakeLeadership.
private boolean tryTakeLeadership() throws Exception {
boolean result = false;
try {
EtcdKeysResponse response = getClient().put(servicePath, serviceName).prevExist(false).ttl(ttl).send().get();
result = ObjectHelper.equal(serviceName, response.node.value);
EtcdHelper.setIndex(index, response);
} catch (EtcdException e) {
if (!e.isErrorCode(EtcdErrorCode.NodeExist)) {
throw e;
}
}
return result;
}
Aggregations