Add JedisClusterCommand and updated code to use it respectively

This commit is contained in:
Marcos Nils
2013-12-10 10:25:41 -03:00
parent 0ebbf02c94
commit c008070045
4 changed files with 156 additions and 44 deletions

View File

@@ -0,0 +1,23 @@
package redis.clients.jedis;
import redis.clients.jedis.exceptions.JedisMovedDataException;
public abstract class JedisClusterCommand<T> {
private JedisClusterConnectionHandler connectionHandler;
public JedisClusterCommand(JedisClusterConnectionHandler connectionHandler) {
this.connectionHandler = connectionHandler;
}
public abstract T execute();
public T run() {
try {
return execute();
} catch (JedisMovedDataException e) {
//TODO: Retry here
}
return null;
}
}