use of com.hazelcast.spi.discovery.integration.DiscoveryServiceProvider 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;
}
Aggregations