-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathClusterConnection.java
53 lines (42 loc) · 1.37 KB
/
ClusterConnection.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.redislabs.redisgraph.impl.api;
import com.redislabs.redisgraph.Connection;
import redis.clients.jedis.Client;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.commands.ProtocolCommand;
/**
* Cluster Connection implementation of the Connection interface for RedisGraph
*/
public class ClusterConnection implements Connection {
private final JedisCluster cluster;
public ClusterConnection(JedisCluster cluster) {
this.cluster = cluster;
}
@Override
public Object sendCommand(ProtocolCommand cmd, String... args) {
return cluster.sendCommand(args[0], cmd, args);
}
@Override
public Object sendBlockingCommand(ProtocolCommand cmd, String... args) {
return cluster.sendBlockingCommand(args[0], cmd, args);
}
@Override
public void close() {
// Doesn't actually close the connection
}
@Override
public String watch(String... keys) {
throw new UnsupportedOperationException("Cluster does not support watch");
}
@Override
public String unwatch() {
throw new UnsupportedOperationException("Cluster does not support unwatch");
}
@Override
public Client getClient() {
throw new UnsupportedOperationException("Cluster does not support pipeline");
}
@Override
public void disconnect() {
cluster.close();
}
}