Created
November 1, 2015 17:16
-
-
Save ekirastogi/eca85c09837ff002371c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ekiras.demo; | |
import com.hazelcast.client.HazelcastClient; | |
import com.hazelcast.client.config.ClientConfig; | |
import com.hazelcast.core.HazelcastInstance; | |
/** | |
* Created by ekansh on 1/11/15. | |
*/ | |
public class HazelCastConfig{ | |
public static HazelcastInstance hazelcastInstance; | |
public static String address; | |
public static HazelcastInstance getHazelcastInstance(){ | |
if(!(hazelcastInstance!=null && hazelcastInstance.getLifecycleService().isRunning())){ | |
ClientConfig clientConfig = new ClientConfig(); | |
clientConfig.getNetworkConfig().setConnectionAttemptLimit(10); | |
clientConfig.getNetworkConfig().setConnectionAttemptPeriod(24 * 60); | |
clientConfig.getNetworkConfig().setConnectionTimeout(1000); | |
clientConfig.getNetworkConfig().addAddress(address); | |
hazelcastInstance = HazelcastClient.newHazelcastClient(clientConfig); | |
} | |
return hazelcastInstance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment