Search in sources :

Example 1 with ConnectionException

use of org.apache.geode.internal.tcp.ConnectionException in project geode by apache.

the class LocatorDiscovery method exchangeLocalLocators.

private void exchangeLocalLocators() {
    int retryAttempt = 1;
    while (!getDiscoverer().isStopped()) {
        try {
            RemoteLocatorJoinResponse response = (RemoteLocatorJoinResponse) locatorClient.requestToServer(locatorId.getHost(), locatorId.getPort(), request, WanLocatorDiscoverer.WAN_LOCATOR_CONNECTION_TIMEOUT);
            if (response != null) {
                LocatorHelper.addExchangedLocators(response.getLocators(), this.locatorListener);
                logger.info(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_EXCHANGED_LOCATOR_INFORMATION_0_WITH_1, new Object[] { request.getLocator(), locatorId, response.getLocators() }));
                break;
            }
        } catch (IOException ioe) {
            if (retryAttempt == WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT) {
                ConnectionException coe = new ConnectionException("Not able to connect to local locator after " + WAN_LOCATOR_CONNECTION_RETRY_ATTEMPT + " retry attempts", ioe);
                logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2, new Object[] { request.getLocator(), locatorId, retryAttempt }), coe);
                break;
            }
            if (skipFailureLogging(locatorId)) {
                logger.warn(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_COULD_NOT_EXCHANGE_LOCATOR_INFORMATION_0_WITH_1_AFTER_2_RETRYING_IN_3_MS, new Object[] { request.getLocator(), locatorId, retryAttempt, WAN_LOCATOR_CONNECTION_INTERVAL }));
            }
            try {
                Thread.sleep(WAN_LOCATOR_CONNECTION_INTERVAL);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
            retryAttempt++;
            continue;
        } catch (ClassNotFoundException classNotFoundException) {
            logger.fatal(LocalizedMessage.create(LocalizedStrings.LOCATOR_DISCOVERY_TASK_ENCOUNTERED_UNEXPECTED_EXCEPTION), classNotFoundException);
            break;
        }
    }
}
Also used : IOException(java.io.IOException) ConnectionException(org.apache.geode.internal.tcp.ConnectionException)

Example 2 with ConnectionException

use of org.apache.geode.internal.tcp.ConnectionException in project geode by apache.

the class GMSMemberFactory method newMembershipManager.

public MembershipManager newMembershipManager(DistributedMembershipListener listener, DistributionConfig config, RemoteTransportConfig transport, DMStats stats) throws DistributionException {
    Services services = new Services(listener, config, transport, stats);
    try {
        services.init();
        services.start();
    } catch (ConnectionException e) {
        throw new DistributionException(LocalizedStrings.MemberFactory_UNABLE_TO_CREATE_MEMBERSHIP_MANAGER.toLocalizedString(), e);
    } catch (GemFireConfigException | SystemConnectException | GemFireSecurityException e) {
        throw e;
    } catch (RuntimeException e) {
        Services.getLogger().error("Unexpected problem starting up membership services", e);
        throw new SystemConnectException("Problem starting up membership services", e);
    }
    return (MembershipManager) services.getManager();
}
Also used : MemberServices(org.apache.geode.distributed.internal.membership.MemberServices) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) GemFireConfigException(org.apache.geode.GemFireConfigException) MembershipManager(org.apache.geode.distributed.internal.membership.MembershipManager) DistributionException(org.apache.geode.distributed.internal.DistributionException) ConnectionException(org.apache.geode.internal.tcp.ConnectionException) SystemConnectException(org.apache.geode.SystemConnectException)

Aggregations

ConnectionException (org.apache.geode.internal.tcp.ConnectionException)2 IOException (java.io.IOException)1 GemFireConfigException (org.apache.geode.GemFireConfigException)1 SystemConnectException (org.apache.geode.SystemConnectException)1 DistributionException (org.apache.geode.distributed.internal.DistributionException)1 MemberServices (org.apache.geode.distributed.internal.membership.MemberServices)1 MembershipManager (org.apache.geode.distributed.internal.membership.MembershipManager)1 GemFireSecurityException (org.apache.geode.security.GemFireSecurityException)1