Several changes have been added to this commit:

- Add asking to cluster commands
- Make jedis cluster return connection to original pool
- Add tests for MOVED and ASK cluster responses
- Refactor connection handler to recalculate connections based on slots

This commit makes the first usable version of Jedis along with Redis Cluster
This commit is contained in:
Marcos Nils
2014-01-03 16:42:21 -03:00
parent 1b26815799
commit dd0bbdaf91
10 changed files with 349 additions and 265 deletions

View File

@@ -1,11 +1,12 @@
package redis.clients.jedis.exceptions;
import redis.clients.jedis.HostAndPort;
public class JedisAskDataException extends JedisDataException {
private static final long serialVersionUID = 3878126572474819403L;
public JedisAskDataException(String message) {
super(message);
}
private HostAndPort targetNode;
private int slot;
public JedisAskDataException(Throwable cause) {
super(cause);
@@ -14,4 +15,18 @@ public class JedisAskDataException extends JedisDataException {
public JedisAskDataException(String message, Throwable cause) {
super(message, cause);
}
public JedisAskDataException(String message, HostAndPort targetHost, int slot) {
super(message);
this.targetNode = targetHost;
this.slot = slot;
}
public HostAndPort getTargetNode() {
return targetNode;
}
public int getSlot() {
return slot;
}
}