public void monitor() throws MonitorException {
schedulers.watch(new SchedulerMonitor());
}
private Optional<HostAndPort> getLeaderHttp() {
ServiceInstance leadingScheduler = leader.get();
if (leadingScheduler == null) {
return Optional.absent();
}
if (leadingScheduler.isSetAdditionalEndpoints()) {
Endpoint leaderHttp = leadingScheduler.getAdditionalEndpoints().get(HTTP_PORT_NAME);
if (leaderHttp != null && leaderHttp.isSetHost() && leaderHttp.isSetPort()) {
return Optional.of(HostAndPort.fromParts(leaderHttp.getHost(), leaderHttp.getPort()));
}
}