use of org.talend.esb.servicelocator.client.ServiceLocator.PostConnectAction in project tesb-rt-se by Talend.
the class ZKBackend method connect.
@Override
public RootNode connect() throws InterruptedException, ServiceLocatorException {
if (!isConnected()) {
disconnect();
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Start connect session");
}
CountDownLatch connectionLatch = new CountDownLatch(1);
zk = createZooKeeper(connectionLatch);
if (authentication) {
authenticate();
}
boolean connected = connectionLatch.await(settings.getConnectionTimeout(), TimeUnit.MILLISECONDS);
if (!connected) {
throw new ServiceLocatorException("Connection to Service Locator failed.");
}
for (PostConnectAction postConnectAction : postConnectActions) {
postConnectAction.process(null);
}
if (LOG.isLoggable(Level.FINER)) {
LOG.log(Level.FINER, "End connect session");
}
}
return rootNode;
}
Aggregations