use of com.kixeye.chassis.bootstrap.BootstrapException in project chassis by Kixeye.
the class DynamicZookeeperConfigurationSource method initializeZookeeperConfigurationSource.
private void initializeZookeeperConfigurationSource() {
if (running) {
LOGGER.warn("Detected creation of node {}, but zookeeper configuration source already running. This should not happen. Ignoring event...", instanceConfigPath);
return;
}
this.zooKeeperConfigurationSource = new ZooKeeperConfigurationSource(curatorFramework, instanceConfigPath);
listeners.forEach(new Function<WatchedUpdateListener, Void>() {
@Nullable
@Override
public Void apply(@Nullable WatchedUpdateListener watchedUpdateListener) {
zooKeeperConfigurationSource.addUpdateListener(watchedUpdateListener);
return null;
}
});
try {
zooKeeperConfigurationSource.start();
} catch (Exception e) {
LOGGER.error("errro starting zookeeper configuration source", e);
throw new BootstrapException("Error initializing zookeeper configuration source", e);
}
running = true;
}
use of com.kixeye.chassis.bootstrap.BootstrapException in project chassis by Kixeye.
the class ServerInstanceContext method initExhibitor.
private void initExhibitor() {
LOGGER.info("Initializing exhibitor info...");
List<LoadBalancerDescription> loadBalancers = AwsUtils.findLoadBalancers(amazonElasticLoadBalancing, new ZookeeperElbFilter(environment));
if (loadBalancers.size() == 0) {
LOGGER.info("No Zookeeper ELBs for environment " + environment);
return;
} else if (loadBalancers.size() != 1) {
throw new BootstrapException("Found multiple Zookeeper ELBs for environment " + environment);
}
LoadBalancerDescription loadBalancer = loadBalancers.get(0);
ListenerDescription exhibitorListenerDescription = getExhibitorListenerDescription(loadBalancer);
this.exhibitorHost = loadBalancer.getDNSName();
this.exhibitorPort = exhibitorListenerDescription.getListener().getLoadBalancerPort();
LOGGER.info("Initialized exhibitor info with: exhibitorHost: {}, exhibitorPort: {}", exhibitorHost, exhibitorPort);
}
use of com.kixeye.chassis.bootstrap.BootstrapException in project chassis by Kixeye.
the class ZookeeperConfigurationWriter method deleteKey.
private void deleteKey(String key) {
try {
LOGGER.info("deleting key {}...", key);
curatorFramework.delete().forPath(key);
} catch (Exception e) {
throw new BootstrapException("Failed to delete key " + key, e);
}
}
Aggregations