Search in sources :

Example 16 with ClientNetworkConfig

use of com.hazelcast.client.config.ClientNetworkConfig in project hazelcast by hazelcast.

the class HazelcastClientInstanceImpl method initDiscoveryService.

private DiscoveryService initDiscoveryService(ClientConfig config) {
    // and strategies are resolved but the AddressProvider is never registered
    if (!properties.getBoolean(ClientProperty.DISCOVERY_SPI_ENABLED)) {
        return null;
    }
    ILogger logger = loggingService.getLogger(DiscoveryService.class);
    ClientNetworkConfig networkConfig = config.getNetworkConfig();
    DiscoveryConfig discoveryConfig = networkConfig.getDiscoveryConfig().getAsReadOnly();
    DiscoveryServiceProvider factory = discoveryConfig.getDiscoveryServiceProvider();
    if (factory == null) {
        factory = new DefaultDiscoveryServiceProvider();
    }
    DiscoveryServiceSettings settings = new DiscoveryServiceSettings().setConfigClassLoader(config.getClassLoader()).setLogger(logger).setDiscoveryMode(DiscoveryMode.Client).setDiscoveryConfig(discoveryConfig);
    DiscoveryService discoveryService = factory.newDiscoveryService(settings);
    discoveryService.start();
    return discoveryService;
}
Also used : DefaultDiscoveryServiceProvider(com.hazelcast.spi.discovery.impl.DefaultDiscoveryServiceProvider) DiscoveryServiceProvider(com.hazelcast.spi.discovery.integration.DiscoveryServiceProvider) DefaultDiscoveryServiceProvider(com.hazelcast.spi.discovery.impl.DefaultDiscoveryServiceProvider) ILogger(com.hazelcast.logging.ILogger) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) DiscoveryService(com.hazelcast.spi.discovery.integration.DiscoveryService) DiscoveryServiceSettings(com.hazelcast.spi.discovery.integration.DiscoveryServiceSettings) ClientNetworkConfig(com.hazelcast.client.config.ClientNetworkConfig)

Example 17 with ClientNetworkConfig

use of com.hazelcast.client.config.ClientNetworkConfig in project hazelcast by hazelcast.

the class DummyClientCachePartitionIteratorTest method getClientConfig.

private static ClientConfig getClientConfig(HazelcastInstance instance) {
    Address address = instance.getCluster().getLocalMember().getAddress();
    String addressString = address.getHost() + ":" + address.getPort();
    ClientConfig clientConfig = new ClientConfig();
    ClientNetworkConfig networkConfig = new ClientNetworkConfig();
    networkConfig.setSmartRouting(false);
    networkConfig.addAddress(addressString);
    clientConfig.setNetworkConfig(networkConfig);
    return clientConfig;
}
Also used : Address(com.hazelcast.nio.Address) ClientConfig(com.hazelcast.client.config.ClientConfig) ClientNetworkConfig(com.hazelcast.client.config.ClientNetworkConfig)

Example 18 with ClientNetworkConfig

use of com.hazelcast.client.config.ClientNetworkConfig in project hazelcast by hazelcast.

the class ClientReplicatedMapLiteMemberTest method configureDummyClientConnection.

private void configureDummyClientConnection(HazelcastInstance instance) throws UnknownHostException {
    InetSocketAddress socketAddress = getAddress(instance).getInetSocketAddress();
    dummyClientConfig.setProperty(ClientProperty.SHUFFLE_MEMBER_LIST.getName(), "false");
    ClientNetworkConfig networkConfig = dummyClientConfig.getNetworkConfig();
    networkConfig.addAddress(socketAddress.getHostName() + ":" + socketAddress.getPort());
}
Also used : InetSocketAddress(java.net.InetSocketAddress) ClientNetworkConfig(com.hazelcast.client.config.ClientNetworkConfig)

Aggregations

ClientNetworkConfig (com.hazelcast.client.config.ClientNetworkConfig)18 ClientConfig (com.hazelcast.client.config.ClientConfig)13 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 DefaultDiscoveryServiceProvider (com.hazelcast.spi.discovery.impl.DefaultDiscoveryServiceProvider)6 DiscoveryService (com.hazelcast.spi.discovery.integration.DiscoveryService)6 DiscoveryServiceProvider (com.hazelcast.spi.discovery.integration.DiscoveryServiceProvider)6 XmlClientConfigBuilder (com.hazelcast.client.config.XmlClientConfigBuilder)5 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)5 Address (com.hazelcast.nio.Address)5 DefaultDiscoveryService (com.hazelcast.spi.discovery.impl.DefaultDiscoveryService)5 InputStream (java.io.InputStream)4 DiscoveryServiceSettings (com.hazelcast.spi.discovery.integration.DiscoveryServiceSettings)3 ClientAwsConfig (com.hazelcast.client.config.ClientAwsConfig)2 AddressTranslator (com.hazelcast.client.connection.AddressTranslator)2 ILogger (com.hazelcast.logging.ILogger)2 InetSocketAddress (java.net.InetSocketAddress)2 HazelcastClient (com.hazelcast.client.HazelcastClient)1 AddressProvider (com.hazelcast.client.connection.AddressProvider)1 AwsAddressProvider (com.hazelcast.client.spi.impl.AwsAddressProvider)1