Netflix/dyno

dyno client does not supports a singleton Implementation

Closed this issue · 0 comments

I build a dynomite cluster of 3 racks. Each rack consists of two nodes.
I implemented dyno client for Java. I used singleton Implementation. if one of the node is getting down. then I am observed errors of peer not connected. if I again establish the connection when one of the node get down. it works properly

connection code

`public static DynoJedisClient establishingConnection() {

	DynoJedisClient dynoclient = null;
	String client = Configuration.getProperty(CacheConstants.DYNOMITE_CLIENT, "dynomiteclient");
	String cluster = Configuration.getProperty(CacheConstants.DYNOMITE_CLUSTER, "dynomitecluster");
	String seeds = Configuration.getProperty(CacheConstants.DYNOMITE_SEEDS, "RedisMaster:192.168.56.221:8102:rack1:dc1:0|RedisSlave01:192.168.56.222:8102:rack2:dc1:0|RedisSlave02:192.168.56.223:8102:rack3:dc1:0");
	System.out.println(seeds);
	List<DynomiteNodeInfo> nodes = DynomiteSeedsParser.parse(seeds);
	ArchiesProperties properties = DynomiteProperties.setProperties(client, seeds, 10, 3000,3,2000);
	dynoclient = new DynoJedisClient.Builder()
			.withApplicationName(client)
			.withDynomiteClusterName(cluster)
			.withCPConfig(new ArchaiusConnectionPoolConfiguration(client)
					.withTokenSupplier(properties.getTokenMapSupplier())
					.setMaxConnsPerHost(properties.getMaxConnectionPerHost())
					.setConnectTimeout(properties.getConnectionTimeout()))
			.withHostSupplier(TokenMapSupplierHelper.toHostSupplier(nodes))
			.build();
	return dynoclient;
}`

=================================================================
single ton implementation

public static DynoJedisClient build() { DynoJedisClient dynoClient = dynoJedisClient.get(module); if (dynoJedisClient.get(module) == null) { synchronized(DynomiteConnection.class) { if (dynoJedisClient.get(module) == null) { dynoClient = establishingConnection() ; dynoJedisClient.put(module,dynoClient); } } } return dynoClient; }