Add functionality to recalculate slots when receiving MOVED response from node.

Add test to check for ASK responses (implementation missing)
This commit is contained in:
Marcos Nils
2014-01-02 20:52:17 -03:00
parent b2d22e2060
commit 1b26815799
5 changed files with 94 additions and 24 deletions

View File

@@ -6,6 +6,7 @@ import redis.clients.jedis.exceptions.JedisMovedDataException;
public abstract class JedisClusterCommand<T> {
private JedisClusterConnectionHandler connectionHandler;
private boolean asking = false;
public JedisClusterCommand(JedisClusterConnectionHandler connectionHandler) {
this.connectionHandler = connectionHandler;
@@ -17,10 +18,10 @@ public abstract class JedisClusterCommand<T> {
try {
return execute();
} catch (JedisMovedDataException jme) {
//TODO: Do Retry here
this.connectionHandler.assignSlotToNode(jme.getSlot(), jme.getTargetNode());
return execute();
} catch (JedisAskDataException jae) {
//TODO: Do ASK here
throw jae;
}
return null;
}
}