MasterSlave consistency and old mode compatibility with shard names

This commit is contained in:
Dario Guzik
2011-05-15 18:22:34 -03:00
parent 5c9d516598
commit 37587df2b6
5 changed files with 153 additions and 5 deletions

View File

@@ -22,11 +22,12 @@ public class JedisShardInfo extends ShardInfo<Jedis> {
public String toString() {
return host + ":" + port + "*" + getWeight();
}
private int timeout;
private String host;
private int port;
private String password = null;
private String name = null;
public String getHost() {
return host;
@@ -39,15 +40,27 @@ public class JedisShardInfo extends ShardInfo<Jedis> {
public JedisShardInfo(String host) {
this(host, Protocol.DEFAULT_PORT);
}
public JedisShardInfo(String host, String name) {
this(host, Protocol.DEFAULT_PORT, name);
}
public JedisShardInfo(String host, int port) {
this(host, port, 2000);
}
public JedisShardInfo(String host, int port, String name) {
this(host, port, 2000, name);
}
public JedisShardInfo(String host, int port, int timeout) {
this(host, port, timeout, Sharded.DEFAULT_WEIGHT);
}
public JedisShardInfo(String host, int port, int timeout, String name) {
this(host, port, timeout, Sharded.DEFAULT_WEIGHT);
this.name = name;
}
public JedisShardInfo(String host, int port, int timeout, int weight) {
super(weight);
this.host = host;
@@ -70,6 +83,10 @@ public class JedisShardInfo extends ShardInfo<Jedis> {
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public String getName() {
return name ;
}
@Override
public Jedis createResource() {