From 1e356bf449dfe9ec00441ffac467a8bc165796d0 Mon Sep 17 00:00:00 2001 From: Feng Date: Mon, 11 May 2020 10:32:26 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-3881=20=E7=8A=B6=E6=80=81=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8+=E9=9B=86=E7=BE=A4=E9=94=81=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81=E8=A7=A3=E8=80=A6=EF=BC=8C=E8=84=B1?= =?UTF-8?q?=E7=A6=BB=E4=BE=9D=E8=B5=96redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/third/redis/clients/jedis/JedisCluster.java | 10 ++++++++++ .../com/fr/third/redis/clients/jedis/JedisPubSub.java | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisCluster.java b/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisCluster.java index c9d5713a7..dd7de359d 100644 --- a/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisCluster.java +++ b/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisCluster.java @@ -1976,4 +1976,14 @@ public class JedisCluster extends BinaryJedisCluster implements JedisClusterComm } }.run(key); } + + //暴露出Client, 方便上层解耦 + public Client getClient() { + + Jedis jedis = this.connectionHandler.getConnection(); + if (jedis != null) { + return jedis.getClient(); + } + return null; + } } diff --git a/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisPubSub.java b/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisPubSub.java index ac1cc4a76..ef2973500 100644 --- a/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisPubSub.java +++ b/fine-jedis/src/main/java/com/fr/third/redis/clients/jedis/JedisPubSub.java @@ -21,6 +21,14 @@ public abstract class JedisPubSub { private int subscribedChannels = 0; private volatile Client client; + public JedisPubSub() { + + } + + public JedisPubSub(Client client) { + this.client = client; + } + public void onMessage(String channel, String message) { }