From 3f6d4208f2e2212f185f2fe4b0d5dc9bc7e91679 Mon Sep 17 00:00:00 2001 From: "Dylan.Liu" Date: Sun, 26 Apr 2020 15:24:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=20=E4=B8=BB=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E4=BB=A3=E7=A0=81=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../state/BaseFineStoreGenericPool.java | 20 +++++++++++++++++++ .../cluster/state/BaseFineStoreWrapper.java | 19 ++++++++++++++++++ .../api/cluster/state/FineJedisPoolKit.java | 2 +- .../api/cluster/state/StandAloneJedisKit.java | 4 ++-- .../cluster/state/FineJedisPoolKitTest.java | 4 ++-- .../cluster/state/StandAloneJedisKitTest.java | 2 +- 6 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/fanruan/api/cluster/state/BaseFineStoreGenericPool.java create mode 100644 src/main/java/com/fanruan/api/cluster/state/BaseFineStoreWrapper.java diff --git a/src/main/java/com/fanruan/api/cluster/state/BaseFineStoreGenericPool.java b/src/main/java/com/fanruan/api/cluster/state/BaseFineStoreGenericPool.java new file mode 100644 index 0000000..9cf1857 --- /dev/null +++ b/src/main/java/com/fanruan/api/cluster/state/BaseFineStoreGenericPool.java @@ -0,0 +1,20 @@ +package com.fanruan.api.cluster.state; + +import com.fr.collections.config.CollectionsConfig; +import com.fr.store.impl.accessor.api.AbstractFineStoreGenericPool; + +/** + * @author Dylan.Liu + * @version 10.0 + * Created by Dylan.Liu on 2020/4/26 + * 供插件使用 + * 设置资源连接池, 注册实际资源 + */ +public abstract class BaseFineStoreGenericPool extends AbstractFineStoreGenericPool { + + @Override + public abstract boolean accept(CollectionsConfig config); + + @Override + public abstract BaseFineStoreWrapper refresh(T redisConfig); +} diff --git a/src/main/java/com/fanruan/api/cluster/state/BaseFineStoreWrapper.java b/src/main/java/com/fanruan/api/cluster/state/BaseFineStoreWrapper.java new file mode 100644 index 0000000..af94ee1 --- /dev/null +++ b/src/main/java/com/fanruan/api/cluster/state/BaseFineStoreWrapper.java @@ -0,0 +1,19 @@ +package com.fanruan.api.cluster.state; + + +import com.fr.store.impl.accessor.api.FineStoreAdapter; +import com.fr.store.impl.accessor.api.FineStoreWrapper; + +/** + * @author Dylan.Liu + * @version 10.0 + * Created by Dylan.Liu on 2020/4/26 + * 供插件使用的资源包装器 + */ +public abstract class BaseFineStoreWrapper implements FineStoreWrapper { + @Override + public abstract FineStoreAdapter getResource(); + + @Override + public abstract void destroy(); +} diff --git a/src/main/java/com/fanruan/api/cluster/state/FineJedisPoolKit.java b/src/main/java/com/fanruan/api/cluster/state/FineJedisPoolKit.java index c4b5884..84b6ab9 100644 --- a/src/main/java/com/fanruan/api/cluster/state/FineJedisPoolKit.java +++ b/src/main/java/com/fanruan/api/cluster/state/FineJedisPoolKit.java @@ -2,7 +2,7 @@ package com.fanruan.api.cluster.state; import com.fr.store.impl.accessor.FineStorePool; -import com.fr.store.impl.accessor.FineStoreWrapper; +import com.fr.store.impl.accessor.api.FineStoreWrapper; /** * @author Dylan.Liu diff --git a/src/main/java/com/fanruan/api/cluster/state/StandAloneJedisKit.java b/src/main/java/com/fanruan/api/cluster/state/StandAloneJedisKit.java index 900d3eb..ef93415 100644 --- a/src/main/java/com/fanruan/api/cluster/state/StandAloneJedisKit.java +++ b/src/main/java/com/fanruan/api/cluster/state/StandAloneJedisKit.java @@ -1,7 +1,7 @@ package com.fanruan.api.cluster.state; -import com.fr.store.impl.accessor.FineStore; import com.fr.store.impl.accessor.StandAloneStore; +import com.fr.store.impl.accessor.api.FineStoreAdapter; import com.fr.third.redis.clients.jedis.Jedis; /** @@ -16,7 +16,7 @@ public class StandAloneJedisKit { * @param jedis Jedis 资源 * @return 单机版 Jedis Api集合 */ - public static FineStore createStandAloneJedis(Jedis jedis) { + public static FineStoreAdapter createStandAloneJedis(Jedis jedis) { if (jedis == null) { throw new NullPointerException("jedis is null"); diff --git a/src/test/java/com/fanruan/api/cluster/state/FineJedisPoolKitTest.java b/src/test/java/com/fanruan/api/cluster/state/FineJedisPoolKitTest.java index 02c82ee..38f3124 100644 --- a/src/test/java/com/fanruan/api/cluster/state/FineJedisPoolKitTest.java +++ b/src/test/java/com/fanruan/api/cluster/state/FineJedisPoolKitTest.java @@ -1,8 +1,8 @@ package com.fanruan.api.cluster.state; -import com.fr.store.impl.accessor.FineStore; import com.fr.store.impl.accessor.FineStorePool; -import com.fr.store.impl.accessor.FineStoreWrapper; +import com.fr.store.impl.accessor.api.FineStore; +import com.fr.store.impl.accessor.api.FineStoreWrapper; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/com/fanruan/api/cluster/state/StandAloneJedisKitTest.java b/src/test/java/com/fanruan/api/cluster/state/StandAloneJedisKitTest.java index dd74611..e871ad1 100644 --- a/src/test/java/com/fanruan/api/cluster/state/StandAloneJedisKitTest.java +++ b/src/test/java/com/fanruan/api/cluster/state/StandAloneJedisKitTest.java @@ -1,6 +1,6 @@ package com.fanruan.api.cluster.state; -import com.fr.store.impl.accessor.FineStore; +import com.fr.store.impl.accessor.api.FineStore; import com.fr.third.redis.clients.jedis.Jedis; import org.easymock.EasyMock; import org.junit.Assert;