Add test for redis cluster max redirections and refactor JedisClusterCommand exception handling
This commit is contained in:
@@ -2,31 +2,19 @@ package redis.clients.jedis.exceptions;
|
||||
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
|
||||
public class JedisAskDataException extends JedisDataException {
|
||||
public class JedisAskDataException extends JedisRedirectionException {
|
||||
private static final long serialVersionUID = 3878126572474819403L;
|
||||
|
||||
private HostAndPort targetNode;
|
||||
private int slot;
|
||||
|
||||
public JedisAskDataException(Throwable cause) {
|
||||
super(cause);
|
||||
public JedisAskDataException(Throwable cause, HostAndPort targetHost, int slot) {
|
||||
super(cause, targetHost, slot);
|
||||
}
|
||||
|
||||
public JedisAskDataException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
public JedisAskDataException(String message, Throwable cause, HostAndPort targetHost, int slot) {
|
||||
super(message, cause, targetHost, slot);
|
||||
}
|
||||
|
||||
public JedisAskDataException(String message, HostAndPort targetHost, int slot) {
|
||||
super(message);
|
||||
this.targetNode = targetHost;
|
||||
this.slot = slot;
|
||||
super(message, targetHost, slot);
|
||||
}
|
||||
|
||||
public HostAndPort getTargetNode() {
|
||||
return targetNode;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package redis.clients.jedis.exceptions;
|
||||
|
||||
|
||||
public class JedisClusterMaxRedirectionsException extends JedisDataException {
|
||||
private static final long serialVersionUID = 3878126572474819403L;
|
||||
|
||||
public JedisClusterMaxRedirectionsException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public JedisClusterMaxRedirectionsException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public JedisClusterMaxRedirectionsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -3,35 +3,19 @@ package redis.clients.jedis.exceptions;
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
|
||||
|
||||
public class JedisMovedDataException extends JedisDataException {
|
||||
public class JedisMovedDataException extends JedisRedirectionException {
|
||||
private static final long serialVersionUID = 3878126572474819403L;
|
||||
|
||||
private HostAndPort targetNode;
|
||||
private int slot;
|
||||
|
||||
public JedisMovedDataException(String message, HostAndPort targetNode, int slot) {
|
||||
super(message);
|
||||
this.targetNode = targetNode;
|
||||
this.slot = slot;
|
||||
super(message, targetNode, slot);
|
||||
}
|
||||
|
||||
public JedisMovedDataException(Throwable cause, HostAndPort targetNode, int slot) {
|
||||
super(cause);
|
||||
this.targetNode = targetNode;
|
||||
this.slot = slot;
|
||||
super(cause, targetNode, slot);
|
||||
}
|
||||
|
||||
public JedisMovedDataException(String message, Throwable cause, HostAndPort targetNode, int slot) {
|
||||
super(message, cause);
|
||||
this.targetNode = targetNode;
|
||||
this.slot = slot;
|
||||
super(message, cause, targetNode, slot);
|
||||
}
|
||||
|
||||
public HostAndPort getTargetNode() {
|
||||
return targetNode;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package redis.clients.jedis.exceptions;
|
||||
|
||||
import redis.clients.jedis.HostAndPort;
|
||||
|
||||
|
||||
public class JedisRedirectionException extends JedisDataException {
|
||||
private static final long serialVersionUID = 3878126572474819403L;
|
||||
|
||||
private HostAndPort targetNode;
|
||||
private int slot;
|
||||
|
||||
public JedisRedirectionException(String message, HostAndPort targetNode, int slot) {
|
||||
super(message);
|
||||
this.targetNode = targetNode;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public JedisRedirectionException(Throwable cause, HostAndPort targetNode, int slot) {
|
||||
super(cause);
|
||||
this.targetNode = targetNode;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public JedisRedirectionException(String message, Throwable cause, HostAndPort targetNode, int slot) {
|
||||
super(message, cause);
|
||||
this.targetNode = targetNode;
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
public HostAndPort getTargetNode() {
|
||||
return targetNode;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user