Search in sources :

Example 1 with NodeFilter

use of com.hazelcast.spi.discovery.NodeFilter in project hazelcast by hazelcast.

the class DefaultDiscoveryService method getNodeFilter.

private NodeFilter getNodeFilter(DiscoveryServiceSettings settings) {
    DiscoveryConfig discoveryConfig = settings.getDiscoveryConfig();
    ClassLoader configClassLoader = settings.getConfigClassLoader();
    if (discoveryConfig.getNodeFilter() != null) {
        return discoveryConfig.getNodeFilter();
    }
    if (discoveryConfig.getNodeFilterClass() != null) {
        try {
            ClassLoader cl = configClassLoader;
            if (cl == null) {
                cl = DefaultDiscoveryService.class.getClassLoader();
            }
            String className = discoveryConfig.getNodeFilterClass();
            return (NodeFilter) cl.loadClass(className).newInstance();
        } catch (Exception e) {
            throw new RuntimeException("Failed to configure discovery node filter", e);
        }
    }
    return null;
}
Also used : DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException) HazelcastException(com.hazelcast.core.HazelcastException) ValidationException(com.hazelcast.config.properties.ValidationException) NodeFilter(com.hazelcast.spi.discovery.NodeFilter)

Aggregations

DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)1 InvalidConfigurationException (com.hazelcast.config.InvalidConfigurationException)1 ValidationException (com.hazelcast.config.properties.ValidationException)1 HazelcastException (com.hazelcast.core.HazelcastException)1 NodeFilter (com.hazelcast.spi.discovery.NodeFilter)1