Skip to content

Commit

Permalink
RedisClusterNodes added
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita committed Jul 12, 2016
1 parent b1c519c commit 4a519b7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
28 changes: 28 additions & 0 deletions 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<ClusterNode> implements ClusterNodesGroup {

public RedisClusterNodes(ConnectionManager connectionManager) {
super(connectionManager);
}

}
6 changes: 3 additions & 3 deletions src/main/java/org/redisson/Redisson.java
Expand Up @@ -37,7 +37,7 @@
import org.redisson.connection.MasterSlaveConnectionManager; import org.redisson.connection.MasterSlaveConnectionManager;
import org.redisson.connection.SentinelConnectionManager; import org.redisson.connection.SentinelConnectionManager;
import org.redisson.connection.SingleConnectionManager; import org.redisson.connection.SingleConnectionManager;
import org.redisson.core.ClusterNode; import org.redisson.core.ClusterNodesGroup;
import org.redisson.core.Node; import org.redisson.core.Node;
import org.redisson.core.NodesGroup; import org.redisson.core.NodesGroup;
import org.redisson.core.RAtomicDouble; import org.redisson.core.RAtomicDouble;
Expand Down Expand Up @@ -563,11 +563,11 @@ public NodesGroup<Node> getNodesGroup() {
} }


@Override @Override
public NodesGroup<ClusterNode> getClusterNodesGroup() { public ClusterNodesGroup getClusterNodesGroup() {
if (!config.isClusterConfig()) { if (!config.isClusterConfig()) {
throw new IllegalStateException("Redisson is not in cluster mode!"); throw new IllegalStateException("Redisson is not in cluster mode!");
} }
return new RedisNodes<ClusterNode>(connectionManager); return new RedisClusterNodes(connectionManager);
} }


@Override @Override
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/redisson/RedissonClient.java
Expand Up @@ -22,6 +22,7 @@


import org.redisson.client.codec.Codec; import org.redisson.client.codec.Codec;
import org.redisson.core.ClusterNode; import org.redisson.core.ClusterNode;
import org.redisson.core.ClusterNodesGroup;
import org.redisson.core.Node; import org.redisson.core.Node;
import org.redisson.core.NodesGroup; import org.redisson.core.NodesGroup;
import org.redisson.core.RAtomicDouble; import org.redisson.core.RAtomicDouble;
Expand Down Expand Up @@ -697,7 +698,7 @@ public interface RedissonClient {
* *
* @return * @return
*/ */
NodesGroup<ClusterNode> getClusterNodesGroup(); ClusterNodesGroup getClusterNodesGroup();


/** /**
* Returns {@code true} if this Redisson instance has been shut down. * Returns {@code true} if this Redisson instance has been shut down.
Expand Down
20 changes: 20 additions & 0 deletions 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<ClusterNode> {

}

0 comments on commit 4a519b7

Please sign in to comment.