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

Is DynoClient Supports Single ton Implementation #258

Open
ghost opened this issue Mar 27, 2019 · 3 comments
Open

Is DynoClient Supports Single ton Implementation #258

ghost opened this issue Mar 27, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 27, 2019

No description provided.

@ghost
Copy link
Author

ghost commented Mar 27, 2019

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

`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;
}

@ghost
Copy link
Author

ghost commented Mar 27, 2019

please give any examples or links for singleton Implementation of dyno client

@smukil
Copy link
Contributor

smukil commented Apr 26, 2019

@chinmayvenkat I don't understand your issue properly. If a node is down, you won't be able to talk to it and you'll fallback to a different replica which you say works correctly. The DynoJedisDemo has implementations of how to use the Dyno client:
https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-demo/src/main/java/com/netflix/dyno/demo/redis/DynoJedisDemo.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant