Search in sources :

Example 1 with ConnectorException

use of org.eclipse.net4j.connector.ConnectorException 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);
    }
}
Also used : LifecycleException(org.eclipse.net4j.util.lifecycle.LifecycleException) ConnectorException(org.eclipse.net4j.connector.ConnectorException) SnowowlServiceException(com.b2international.snowowl.core.api.SnowowlServiceException) HeartBeatProtocol(org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol)

Aggregations

SnowowlServiceException (com.b2international.snowowl.core.api.SnowowlServiceException)1 ConnectorException (org.eclipse.net4j.connector.ConnectorException)1 HeartBeatProtocol (org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol)1 LifecycleException (org.eclipse.net4j.util.lifecycle.LifecycleException)1