本文整理汇总了Java中redis.clients.jedis.exceptions.JedisClusterException类的典型用法代码示例。如果您正苦于以下问题:Java JedisClusterException类的具体用法?Java JedisClusterException怎么用?Java JedisClusterException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JedisClusterException类属于redis.clients.jedis.exceptions包,在下文中一共展示了JedisClusterException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processError
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
private static void processError(final RedisInputStream is) {
String message = is.readLine();
// TODO: I'm not sure if this is the best way to do this.
// Maybe Read only first 5 bytes instead?
if (message.startsWith(MOVED_RESPONSE)) {
String[] movedInfo = parseTargetHostAndSlot(message);
throw new JedisMovedDataException(message, new HostAndPort(movedInfo[1], Integer.valueOf(movedInfo[2])),
Integer.valueOf(movedInfo[0]));
} else if (message.startsWith(ASK_RESPONSE)) {
String[] askInfo = parseTargetHostAndSlot(message);
throw new JedisAskDataException(message, new HostAndPort(askInfo[1], Integer.valueOf(askInfo[2])),
Integer.valueOf(askInfo[0]));
} else if (message.startsWith(CLUSTERDOWN_RESPONSE)) {
throw new JedisClusterException(message);
} else if (message.startsWith(BUSY_RESPONSE)) {
throw new JedisBusyException(message);
} else if (message.startsWith(NOSCRIPT_RESPONSE)) {
throw new JedisNoScriptException(message);
}
throw new JedisDataException(message);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:22,代码来源:Protocol.java
示例2: run
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
public T run(int keyCount, String... keys) {
if (keys == null || keys.length == 0) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
// For multiple keys, only execute if they all share the
// same connection slot.
if (keys.length > 1) {
int slot = JedisClusterCRC16.getSlot(keys[0]);
for (int i = 1; i < keyCount; i++) {
int nextSlot = JedisClusterCRC16.getSlot(keys[i]);
if (slot != nextSlot) {
throw new JedisClusterException(
"No way to dispatch this command to Redis Cluster " + "because keys have different slots.");
}
}
}
return runWithRetries(SafeEncoder.encode(keys[0]), this.maxAttempts, false, false);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:21,代码来源:JedisClusterCommand.java
示例3: runBinary
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
public T runBinary(int keyCount, byte[]... keys) {
if (keys == null || keys.length == 0) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
// For multiple keys, only execute if they all share the
// same connection slot.
if (keys.length > 1) {
int slot = JedisClusterCRC16.getSlot(keys[0]);
for (int i = 1; i < keyCount; i++) {
int nextSlot = JedisClusterCRC16.getSlot(keys[i]);
if (slot != nextSlot) {
throw new JedisClusterException(
"No way to dispatch this command to Redis Cluster " + "because keys have different slots.");
}
}
}
return runWithRetries(keys[0], this.maxAttempts, false, false);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:21,代码来源:JedisClusterCommand.java
示例4: processError
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
private static void processError(final RedisInputStream is) {
String message = is.readLine();
// TODO: I'm not sure if this is the best way to do this.
// Maybe Read only first 5 bytes instead?
if (message.startsWith(MOVED_RESPONSE)) {
String[] movedInfo = parseTargetHostAndSlot(message);
throw new JedisMovedDataException(message, new HostAndPort(movedInfo[1],
Integer.valueOf(movedInfo[2])), Integer.valueOf(movedInfo[0]));
} else if (message.startsWith(ASK_RESPONSE)) {
String[] askInfo = parseTargetHostAndSlot(message);
throw new JedisAskDataException(message, new HostAndPort(askInfo[1],
Integer.valueOf(askInfo[2])), Integer.valueOf(askInfo[0]));
} else if (message.startsWith(CLUSTERDOWN_RESPONSE)) {
throw new JedisClusterException(message);
}
throw new JedisDataException(message);
}
开发者ID:x7-framework,项目名称:x7,代码行数:18,代码来源:Protocol.java
示例5: renameToDifferentSlots
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* Implements move of Redis elements where oldkey and newkey don't fall in same slot. The concrete implementation
* depends on the type of data at oldkey.
*
* @param oldkey
* @param newkey
* @return
*/
private String renameToDifferentSlots(byte[] oldkey, byte[] newkey) {
String type = jedisCluster.type(oldkey);
String result;
switch (type) {
case "string":
result = renameString(oldkey, newkey);
break;
case "hash":
result = renameHash(oldkey, newkey);
break;
case "set":
result = renameSet(oldkey, newkey);
break;
case "list":
result = renameList(oldkey, newkey);
break;
case "zrange":
result = renameZRange(oldkey, newkey);
break;
default:
throw new JedisClusterException("Unknown element type " + type + " for key " + encode(oldkey));
}
return result;
}
开发者ID:AmadeusITGroup,项目名称:HttpSessionReplacer,代码行数:33,代码来源:JedisClusterFacade.java
示例6: run
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
public T run(int keyCount, String... keys) {
if (keys == null || keys.length == 0) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
// For multiple keys, only execute if they all share the
// same connection slot.
if (keys.length > 1) {
int slot = JedisClusterCRC16.getSlot(keys[0]);
for (int i = 1; i < keyCount; i++) {
int nextSlot = JedisClusterCRC16.getSlot(keys[i]);
if (slot != nextSlot) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster "
+ "because keys have different slots.");
}
}
}
return runWithRetries(SafeEncoder.encode(keys[0]), this.redirections, false, false);
}
开发者ID:sohutv,项目名称:cachecloud,代码行数:21,代码来源:JedisClusterCommand.java
示例7: runBinary
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
public T runBinary(int keyCount, byte[]... keys) {
if (keys == null || keys.length == 0) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
// For multiple keys, only execute if they all share the
// same connection slot.
if (keys.length > 1) {
int slot = JedisClusterCRC16.getSlot(keys[0]);
for (int i = 1; i < keyCount; i++) {
int nextSlot = JedisClusterCRC16.getSlot(keys[i]);
if (slot != nextSlot) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster "
+ "because keys have different slots.");
}
}
}
return runWithRetries(keys[0], this.redirections, false, false);
}
开发者ID:sohutv,项目名称:cachecloud,代码行数:21,代码来源:JedisClusterCommand.java
示例8: processError
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* 处理Redis集群重定向"请求错误"响应。
*
* @param is
*/
private static void processError(RedisInputStream is) {
String message = is.readLine();
// TODO: I'm not sure if this is the best way to do this.
// Maybe Read only first 5 bytes instead?
if (message.startsWith(MOVED_RESPONSE)) {
String[] movedInfo = parseTargetHostAndSlot(message);
throw new JedisMovedDataException(message, new HostAndPort(
movedInfo[1], Integer.valueOf(movedInfo[2])),
Integer.valueOf(movedInfo[0]));
} else if (message.startsWith(ASK_RESPONSE)) {
String[] askInfo = parseTargetHostAndSlot(message);
throw new JedisAskDataException(message, new HostAndPort(
askInfo[1], Integer.valueOf(askInfo[2])),
Integer.valueOf(askInfo[0]));
} else if (message.startsWith(CLUSTERDOWN_RESPONSE)) {
throw new JedisClusterException(message);
}
throw new JedisDataException(message);
}
开发者ID:EdwardLee03,项目名称:jedis-sr,代码行数:25,代码来源:Protocol.java
示例9: testJedisClusterException
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = JedisClusterException.class)
public void testJedisClusterException() {
String script = "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2],ARGV[3]}";
List<String> keys = new ArrayList<String>();
keys.add("key1");
keys.add("key2");
List<String> args = new ArrayList<String>();
args.add("first");
args.add("second");
args.add("third");
jedisCluster.eval(script, keys, args);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:14,代码来源:ClusterScriptingCommandsTest.java
示例10: testJedisClusterException2
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test(expected = JedisClusterException.class)
public void testJedisClusterException2() {
byte[] script = "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2],ARGV[3]}".getBytes();
List<byte[]> keys = new ArrayList<byte[]>();
keys.add("key1".getBytes());
keys.add("key2".getBytes());
List<byte[]> args = new ArrayList<byte[]>();
args.add("first".getBytes());
args.add("second".getBytes());
args.add("third".getBytes());
jedisCluster.eval(script, keys, args);
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:14,代码来源:ClusterScriptingCommandsTest.java
示例11: run
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
public T run(String key) {
if (key == null) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
return runWithRetries(key, this.redirections, false, false);
}
开发者ID:x7-framework,项目名称:x7,代码行数:8,代码来源:JedisClusterCommand.java
示例12: ping
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster scheduled
* to be removed on next major release
*/
@Deprecated
@Override
public String ping() {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:BinaryJedisCluster.java
示例13: quit
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster scheduled
* to be removed on next major release
*/
@Deprecated
@Override
public String quit() {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:BinaryJedisCluster.java
示例14: flushDB
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster scheduled
* to be removed on next major release
*/
@Deprecated
@Override
public String flushDB() {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:BinaryJedisCluster.java
示例15: dbSize
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster and Redis
* Cluster only uses db index 0 scheduled to be removed on next
* major release
*/
@Deprecated
@Override
public Long dbSize() {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:BinaryJedisCluster.java
示例16: select
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster and Redis
* Cluster only uses db index 0 scheduled to be removed on next
* major release
*/
@Deprecated
@Override
public String select(int index) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:BinaryJedisCluster.java
示例17: flushAll
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster scheduled
* to be removed on next major release
*/
@Deprecated
@Override
public String flushAll() {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:BinaryJedisCluster.java
示例18: auth
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster and Redis
* Cluster doesn't support authorization scheduled to be removed on
* next major release
*/
@Deprecated
@Override
public String auth(String password) {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:11,代码来源:BinaryJedisCluster.java
示例19: save
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster scheduled
* to be removed on next major release
*/
@Deprecated
@Override
public String save() {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:BinaryJedisCluster.java
示例20: bgsave
import redis.clients.jedis.exceptions.JedisClusterException; //导入依赖的package包/类
/**
* @deprecated No key operation doesn't make sense for Redis Cluster scheduled
* to be removed on next major release
*/
@Deprecated
@Override
public String bgsave() {
throw new JedisClusterException("No way to dispatch this command to Redis Cluster.");
}
开发者ID:qq1588518,项目名称:JRediClients,代码行数:10,代码来源:BinaryJedisCluster.java
注:本文中的redis.clients.jedis.exceptions.JedisClusterException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论