From 4a519b71b57165a01a7552c74b106990cf7c622b Mon Sep 17 00:00:00 2001 From: Nikita Date: Tue, 12 Jul 2016 15:21:19 +0300 Subject: [PATCH] RedisClusterNodes added --- .../java/org/redisson/RedisClusterNodes.java | 28 +++++++++++++++++++ src/main/java/org/redisson/Redisson.java | 6 ++-- .../java/org/redisson/RedissonClient.java | 3 +- .../org/redisson/core/ClusterNodesGroup.java | 20 +++++++++++++ 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/main/java/org/redisson/RedisClusterNodes.java create mode 100644 src/main/java/org/redisson/core/ClusterNodesGroup.java diff --git a/src/main/java/org/redisson/RedisClusterNodes.java b/src/main/java/org/redisson/RedisClusterNodes.java new file mode 100644 index 000000000..4b59c8d4c --- /dev/null +++ b/src/main/java/org/redisson/RedisClusterNodes.java @@ -0,0 +1,28 @@ +/** + * Copyright 2016 Nikita Koksharov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.redisson; + +import org.redisson.connection.ConnectionManager; +import org.redisson.core.ClusterNode; +import org.redisson.core.ClusterNodesGroup; + +public class RedisClusterNodes extends RedisNodes implements ClusterNodesGroup { + + public RedisClusterNodes(ConnectionManager connectionManager) { + super(connectionManager); + } + +} diff --git a/src/main/java/org/redisson/Redisson.java b/src/main/java/org/redisson/Redisson.java index 2902f22f9..5262c21b7 100755 --- a/src/main/java/org/redisson/Redisson.java +++ b/src/main/java/org/redisson/Redisson.java @@ -37,7 +37,7 @@ import org.redisson.connection.ElasticacheConnectionManager; import org.redisson.connection.MasterSlaveConnectionManager; import org.redisson.connection.SentinelConnectionManager; import org.redisson.connection.SingleConnectionManager; -import org.redisson.core.ClusterNode; +import org.redisson.core.ClusterNodesGroup; import org.redisson.core.Node; import org.redisson.core.NodesGroup; import org.redisson.core.RAtomicDouble; @@ -563,11 +563,11 @@ public class Redisson implements RedissonClient { } @Override - public NodesGroup getClusterNodesGroup() { + public ClusterNodesGroup getClusterNodesGroup() { if (!config.isClusterConfig()) { throw new IllegalStateException("Redisson is not in cluster mode!"); } - return new RedisNodes(connectionManager); + return new RedisClusterNodes(connectionManager); } @Override diff --git a/src/main/java/org/redisson/RedissonClient.java b/src/main/java/org/redisson/RedissonClient.java index b63d5b3a9..0f4609338 100755 --- a/src/main/java/org/redisson/RedissonClient.java +++ b/src/main/java/org/redisson/RedissonClient.java @@ -22,6 +22,7 @@ import java.util.concurrent.TimeUnit; import org.redisson.client.codec.Codec; import org.redisson.core.ClusterNode; +import org.redisson.core.ClusterNodesGroup; import org.redisson.core.Node; import org.redisson.core.NodesGroup; import org.redisson.core.RAtomicDouble; @@ -697,7 +698,7 @@ public interface RedissonClient { * * @return */ - NodesGroup getClusterNodesGroup(); + ClusterNodesGroup getClusterNodesGroup(); /** * Returns {@code true} if this Redisson instance has been shut down. diff --git a/src/main/java/org/redisson/core/ClusterNodesGroup.java b/src/main/java/org/redisson/core/ClusterNodesGroup.java new file mode 100644 index 000000000..89ca2c3bc --- /dev/null +++ b/src/main/java/org/redisson/core/ClusterNodesGroup.java @@ -0,0 +1,20 @@ +/** + * Copyright 2016 Nikita Koksharov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.redisson.core; + +public interface ClusterNodesGroup extends NodesGroup { + +}