use of org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol in project snow-owl by b2ihealthcare.
the class TransportClient method initConnection.
private synchronized void initConnection() throws SnowowlServiceException {
if (connector != null) {
return;
}
try {
if (Strings.isNullOrEmpty(address)) {
connector = JVMUtil.getConnector(IPluginContainer.INSTANCE, NET_4_J_CONNECTOR_NAME);
} else {
TCPUtil.prepareContainer(IPluginContainer.INSTANCE);
Net4jUtil.prepareContainer(IPluginContainer.INSTANCE);
connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, getAddress());
connector.waitForConnection(transportConfiguration.getConnectionTimeout());
final HeartBeatProtocol watchdog = new HeartBeatProtocol(connector);
watchdog.start(transportConfiguration.getWatchdogRate(), transportConfiguration.getWatchdogTimeout());
}
openCustomProtocols();
} catch (final ConnectorException e) {
LOG.error("Could not connect to server, please check your settings.", e);
throw new SnowowlServiceException("Could not connect to server, please check your settings.", e);
} catch (final IllegalArgumentException e) {
LOG.error("Invalid repository URL: " + e.getMessage(), e);
throw new SnowowlServiceException("Invalid repository URL: " + e.getMessage(), e);
} catch (final LifecycleException e) {
LOG.error("Could not connect to server: " + e.getMessage(), e);
throw new SnowowlServiceException("Could not connect to server: " + e.getMessage(), e);
} catch (final Throwable e) {
LOG.error("Could not connect to server.", e);
throw new SnowowlServiceException("Could not connect to server.", e);
}
}
Aggregations