Search in sources :

Example 1 with DiscoveryAddressTranslator

use of com.hazelcast.client.spi.impl.discovery.DiscoveryAddressTranslator in project hazelcast by hazelcast.

the class DefaultClientConnectionManagerFactory method createConnectionManager.

@Override
public ClientConnectionManager createConnectionManager(ClientConfig config, HazelcastClientInstanceImpl client, DiscoveryService discoveryService) {
    LoggingService loggingService = client.getLoggingService();
    ILogger logger = loggingService.getLogger(HazelcastClient.class);
    ClientAwsConfig awsConfig = config.getNetworkConfig().getAwsConfig();
    AddressTranslator addressTranslator;
    if (awsConfig != null && awsConfig.isEnabled()) {
        try {
            addressTranslator = new AwsAddressTranslator(awsConfig, loggingService);
        } catch (NoClassDefFoundError e) {
            logger.warning("hazelcast-aws.jar might be missing!");
            throw e;
        }
    } else if (discoveryService != null) {
        addressTranslator = new DiscoveryAddressTranslator(discoveryService, client.getProperties().getBoolean(ClientProperty.DISCOVERY_SPI_PUBLIC_IP_ENABLED));
    } else {
        addressTranslator = new DefaultAddressTranslator();
    }
    return new ClientConnectionManagerImpl(client, addressTranslator);
}
Also used : AddressTranslator(com.hazelcast.client.connection.AddressTranslator) DefaultAddressTranslator(com.hazelcast.client.spi.impl.DefaultAddressTranslator) AwsAddressTranslator(com.hazelcast.client.spi.impl.AwsAddressTranslator) DiscoveryAddressTranslator(com.hazelcast.client.spi.impl.discovery.DiscoveryAddressTranslator) AwsAddressTranslator(com.hazelcast.client.spi.impl.AwsAddressTranslator) ClientConnectionManagerImpl(com.hazelcast.client.connection.nio.ClientConnectionManagerImpl) DefaultAddressTranslator(com.hazelcast.client.spi.impl.DefaultAddressTranslator) LoggingService(com.hazelcast.logging.LoggingService) ILogger(com.hazelcast.logging.ILogger) DiscoveryAddressTranslator(com.hazelcast.client.spi.impl.discovery.DiscoveryAddressTranslator) ClientAwsConfig(com.hazelcast.client.config.ClientAwsConfig)

Aggregations

ClientAwsConfig (com.hazelcast.client.config.ClientAwsConfig)1 AddressTranslator (com.hazelcast.client.connection.AddressTranslator)1 ClientConnectionManagerImpl (com.hazelcast.client.connection.nio.ClientConnectionManagerImpl)1 AwsAddressTranslator (com.hazelcast.client.spi.impl.AwsAddressTranslator)1 DefaultAddressTranslator (com.hazelcast.client.spi.impl.DefaultAddressTranslator)1 DiscoveryAddressTranslator (com.hazelcast.client.spi.impl.discovery.DiscoveryAddressTranslator)1 ILogger (com.hazelcast.logging.ILogger)1 LoggingService (com.hazelcast.logging.LoggingService)1