Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client side discovery assumes DiscoveryStrategyConfigs #9722

Closed
neilstevenson opened this issue Jan 21, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@neilstevenson
Copy link

commented Jan 21, 2017

If hazelcast.discovery.enabled on the client side, code assumes DiscoveryStrategyConfigs

  1. If neither DiscoveryServiceProvider or DiscoveryStrategyConfigs is specified, an NPE is thrown.
    A more helpful exception should be provided.

  2. If DiscoveryServiceProvider is specified and DiscoveryStrategyConfigs is not, an NPE is still thrown.

Reproducer for 3.8-EA:

    	try {
            ClientConfig clientConfig1 = new ClientConfig();
            clientConfig1.setProperty("hazelcast.discovery.enabled", Boolean.TRUE.toString());
            HazelcastClient.newHazelcastClient(clientConfig1);
    	} catch (Exception e1) {
    	    // An NPE isn't the most helpful
    	    e1.printStackTrace(System.err);
    	}

    	try {
            ClientConfig clientConfig2 = new ClientConfig();
            clientConfig2.setProperty("hazelcast.discovery.enabled", Boolean.TRUE.toString());
            DiscoveryServiceProvider discoveryServiceProvider = new DiscoveryServiceProvider() {
    			public DiscoveryService newDiscoveryService(DiscoveryServiceSettings arg0) {
    				return (DiscoveryService) new Object();
    			}
    		};
            clientConfig2.getNetworkConfig().getDiscoveryConfig().setDiscoveryServiceProvider(discoveryServiceProvider);
            HazelcastClient.newHazelcastClient(clientConfig2);
    	} catch (Exception e2) {
    	    // DiscoveryServiceProvider is only used if DiscoveryStrategyConfigs is not empty
    	    e2.printStackTrace(System.err);
    	}

@sancar sancar added this to the 3.8 milestone Jan 22, 2017

mdogan added a commit to mdogan/hazelcast that referenced this issue Jan 24, 2017

Print a warning when Discovery SPI enabled but not configured on client
Printing a warning log instead of throwing exception to make similar
behavior with server side.

Fixes hazelcast#9722

@mdogan mdogan closed this in #9741 Jan 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.