DATAREDIS-681 - Fix spelling in MultiNodeResult and ResultByReferenceKeyPositionComparator.

Fix type and method names.

Original Pull Request: #267
This commit is contained in:
Mark Paluch
2017-08-21 11:33:51 +02:00
committed by Christoph Strobl
parent 575296be9d
commit 0dfeb365c9
10 changed files with 40 additions and 30 deletions

View File

@@ -171,7 +171,7 @@ public class ClusterCommandExecutor implements DisposableBean {
* @return
* @throws ClusterCommandExecutionFailureException
*/
public <S, T> MulitNodeResult<T> executeCommandOnAllNodes(final ClusterCommandCallback<S, T> cmd) {
public <S, T> MultiNodeResult<T> executeCommandOnAllNodes(final ClusterCommandCallback<S, T> cmd) {
return executeCommandAsyncOnNodes(cmd, getClusterTopology().getActiveMasterNodes());
}
@@ -182,7 +182,7 @@ public class ClusterCommandExecutor implements DisposableBean {
* @throws ClusterCommandExecutionFailureException
* @throws IllegalArgumentException in case the node could not be resolved to a topology-known node
*/
public <S, T> MulitNodeResult<T> executeCommandAsyncOnNodes(final ClusterCommandCallback<S, T> callback,
public <S, T> MultiNodeResult<T> executeCommandAsyncOnNodes(final ClusterCommandCallback<S, T> callback,
Iterable<RedisClusterNode> nodes) {
Assert.notNull(callback, "Callback must not be null!");
@@ -208,11 +208,11 @@ public class ClusterCommandExecutor implements DisposableBean {
return collectResults(futures);
}
private <T> MulitNodeResult<T> collectResults(Map<NodeExecution, Future<NodeResult<T>>> futures) {
private <T> MultiNodeResult<T> collectResults(Map<NodeExecution, Future<NodeResult<T>>> futures) {
boolean done = false;
MulitNodeResult<T> result = new MulitNodeResult<>();
MultiNodeResult<T> result = new MultiNodeResult<>();
Map<RedisClusterNode, Throwable> exceptions = new HashMap<>();
Set<String> saveGuard = new HashSet<>();
@@ -267,7 +267,7 @@ public class ClusterCommandExecutor implements DisposableBean {
* @return
* @throws ClusterCommandExecutionFailureException
*/
public <S, T> MulitNodeResult<T> executeMuliKeyCommand(final MultiKeyClusterCommandCallback<S, T> cmd,
public <S, T> MultiNodeResult<T> executeMultiKeyCommand(final MultiKeyClusterCommandCallback<S, T> cmd,
Iterable<byte[]> keys) {
Map<RedisClusterNode, Set<byte[]>> nodeKeyMap = new HashMap<>();
@@ -445,7 +445,7 @@ public class ClusterCommandExecutor implements DisposableBean {
}
/**
* {@link NodeResult} encapsules the actual value returned by a {@link ClusterCommandCallback} on a given
* {@link NodeResult} encapsulates the actual value returned by a {@link ClusterCommandCallback} on a given
* {@link RedisClusterNode}.
*
* @author Christoph Strobl
@@ -510,13 +510,13 @@ public class ClusterCommandExecutor implements DisposableBean {
}
/**
* {@link MulitNodeResult} holds all {@link NodeResult} of a command executed on multiple {@link RedisClusterNode}.
* {@link MultiNodeResult} holds all {@link NodeResult} of a command executed on multiple {@link RedisClusterNode}.
*
* @author Christoph Strobl
* @param <T>
* @since 1.7
*/
public static class MulitNodeResult<T> {
public static class MultiNodeResult<T> {
List<NodeResult<T>> nodeResults = new ArrayList<>();
@@ -550,7 +550,7 @@ public class ClusterCommandExecutor implements DisposableBean {
public List<T> resultsAsListSortBy(byte[]... keys) {
ArrayList<NodeResult<T>> clone = new ArrayList<>(nodeResults);
Collections.sort(clone, new ResultByReferenceKeyPositionComperator(keys));
Collections.sort(clone, new ResultByReferenceKeyPositionComparator(keys));
return toList(clone);
}
@@ -591,12 +591,13 @@ public class ClusterCommandExecutor implements DisposableBean {
* {@link Comparator} for sorting {@link NodeResult} by reference keys.
*
* @author Christoph Strobl
* @author Mark Paluch
*/
private static class ResultByReferenceKeyPositionComperator implements Comparator<NodeResult<?>> {
private static class ResultByReferenceKeyPositionComparator implements Comparator<NodeResult<?>> {
List<ByteArrayWrapper> reference;
public ResultByReferenceKeyPositionComperator(byte[]... keys) {
ResultByReferenceKeyPositionComparator(byte[]... keys) {
reference = new ArrayList<>(new ByteArraySet(Arrays.asList(keys)));
}

View File

@@ -42,6 +42,7 @@ import org.springframework.util.CollectionUtils;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.0
*/
class JedisClusterKeyCommands implements RedisKeyCommands {
@@ -70,7 +71,7 @@ class JedisClusterKeyCommands implements RedisKeyCommands {
}
return (long) connection.getClusterCommandExecutor()
.executeMuliKeyCommand((JedisMultiKeyClusterCommandCallback<Long>) (client, key) -> client.del(key),
.executeMultiKeyCommand((JedisMultiKeyClusterCommandCallback<Long>) (client, key) -> client.del(key),
Arrays.asList(keys))
.resultsAsList().size();
}

View File

@@ -27,6 +27,7 @@ import org.springframework.util.CollectionUtils;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.0
*/
class JedisClusterListCommands implements RedisListCommands {
@@ -235,7 +236,7 @@ class JedisClusterListCommands implements RedisListCommands {
}
return connection.getClusterCommandExecutor()
.executeMuliKeyCommand(
.executeMultiKeyCommand(
(JedisMultiKeyClusterCommandCallback<List<byte[]>>) (client, key) -> client.blpop(timeout, key),
Arrays.asList(keys))
.getFirstNonNullNotEmptyOrDefault(Collections.<byte[]> emptyList());
@@ -249,7 +250,7 @@ class JedisClusterListCommands implements RedisListCommands {
public List<byte[]> bRPop(final int timeout, byte[]... keys) {
return connection.getClusterCommandExecutor()
.executeMuliKeyCommand(
.executeMultiKeyCommand(
(JedisMultiKeyClusterCommandCallback<List<byte[]>>) (client, key) -> client.brpop(timeout, key),
Arrays.asList(keys))
.getFirstNonNullNotEmptyOrDefault(Collections.<byte[]> emptyList());

View File

@@ -25,7 +25,7 @@ import java.util.Map.Entry;
import java.util.Properties;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.redis.connection.ClusterCommandExecutor.MulitNodeResult;
import org.springframework.data.redis.connection.ClusterCommandExecutor.MultiNodeResult;
import org.springframework.data.redis.connection.ClusterCommandExecutor.NodeResult;
import org.springframework.data.redis.connection.RedisClusterNode;
import org.springframework.data.redis.connection.RedisClusterServerCommands;
@@ -510,7 +510,7 @@ class JedisClusterServerCommands implements RedisClusterServerCommands {
return connection.getClusterCommandExecutor().executeCommandOnSingleNode(cmd, node);
}
private <T> MulitNodeResult<T> executeCommandOnAllNodes(JedisClusterCommandCallback<T> cmd) {
private <T> MultiNodeResult<T> executeCommandOnAllNodes(JedisClusterCommandCallback<T> cmd) {
return connection.getClusterCommandExecutor().executeCommandOnAllNodes(cmd);
}
}

View File

@@ -37,6 +37,7 @@ import org.springframework.data.redis.util.ByteUtils;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.0
*/
class JedisClusterSetCommands implements RedisSetCommands {
@@ -169,7 +170,8 @@ class JedisClusterSetCommands implements RedisSetCommands {
}
Collection<Set<byte[]>> resultList = connection.getClusterCommandExecutor()
.executeMuliKeyCommand((JedisMultiKeyClusterCommandCallback<Set<byte[]>>) (client, key) -> client.smembers(key),
.executeMultiKeyCommand(
(JedisMultiKeyClusterCommandCallback<Set<byte[]>>) (client, key) -> client.smembers(key),
Arrays.asList(keys))
.resultsAsList();
@@ -235,7 +237,8 @@ class JedisClusterSetCommands implements RedisSetCommands {
}
Collection<Set<byte[]>> resultList = connection.getClusterCommandExecutor()
.executeMuliKeyCommand((JedisMultiKeyClusterCommandCallback<Set<byte[]>>) (client, key) -> client.smembers(key),
.executeMultiKeyCommand(
(JedisMultiKeyClusterCommandCallback<Set<byte[]>>) (client, key) -> client.smembers(key),
Arrays.asList(keys))
.resultsAsList();
@@ -295,7 +298,8 @@ class JedisClusterSetCommands implements RedisSetCommands {
ByteArraySet values = new ByteArraySet(sMembers(source));
Collection<Set<byte[]>> resultList = connection.getClusterCommandExecutor()
.executeMuliKeyCommand((JedisMultiKeyClusterCommandCallback<Set<byte[]>>) (client, key) -> client.smembers(key),
.executeMultiKeyCommand(
(JedisMultiKeyClusterCommandCallback<Set<byte[]>>) (client, key) -> client.smembers(key),
Arrays.asList(others))
.resultsAsList();

View File

@@ -33,6 +33,7 @@ import org.springframework.util.ObjectUtils;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.0
*/
class JedisClusterStringCommands implements RedisStringCommands {
@@ -85,7 +86,7 @@ class JedisClusterStringCommands implements RedisStringCommands {
}
return connection.getClusterCommandExecutor()
.executeMuliKeyCommand((JedisMultiKeyClusterCommandCallback<byte[]>) (client, key) -> client.get(key),
.executeMultiKeyCommand((JedisMultiKeyClusterCommandCallback<byte[]>) (client, key) -> client.get(key),
Arrays.asList(keys))
.resultsAsListSortBy(keys);
}

View File

@@ -27,6 +27,7 @@ import org.springframework.util.CollectionUtils;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.0
*/
class LettuceClusterListCommands extends LettuceListCommands {
@@ -50,7 +51,7 @@ class LettuceClusterListCommands extends LettuceListCommands {
return super.bLPop(timeout, keys);
}
List<KeyValue<byte[], byte[]>> resultList = connection.getClusterCommandExecutor().executeMuliKeyCommand(
List<KeyValue<byte[], byte[]>> resultList = connection.getClusterCommandExecutor().executeMultiKeyCommand(
(LettuceMultiKeyClusterCommandCallback<KeyValue<byte[], byte[]>>) (client, key) -> client.blpop(timeout, key),
Arrays.asList(keys)).resultsAsList();
@@ -74,7 +75,7 @@ class LettuceClusterListCommands extends LettuceListCommands {
return super.bRPop(timeout, keys);
}
List<KeyValue<byte[], byte[]>> resultList = connection.getClusterCommandExecutor().executeMuliKeyCommand(
List<KeyValue<byte[], byte[]>> resultList = connection.getClusterCommandExecutor().executeMultiKeyCommand(
(LettuceMultiKeyClusterCommandCallback<KeyValue<byte[], byte[]>>) (client, key) -> client.brpop(timeout, key),
Arrays.asList(keys)).resultsAsList();

View File

@@ -25,7 +25,7 @@ import java.util.Map.Entry;
import java.util.Properties;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.redis.connection.ClusterCommandExecutor.MulitNodeResult;
import org.springframework.data.redis.connection.ClusterCommandExecutor.MultiNodeResult;
import org.springframework.data.redis.connection.ClusterCommandExecutor.NodeResult;
import org.springframework.data.redis.connection.RedisClusterNode;
import org.springframework.data.redis.connection.RedisClusterServerCommands;
@@ -361,7 +361,7 @@ class LettuceClusterServerCommands extends LettuceServerCommands implements Redi
return connection.getClusterCommandExecutor().executeCommandOnSingleNode(command, node);
}
private <T> MulitNodeResult<T> executeCommandOnAllNodes(final LettuceClusterCommandCallback<T> cmd) {
private <T> MultiNodeResult<T> executeCommandOnAllNodes(final LettuceClusterCommandCallback<T> cmd) {
return connection.getClusterCommandExecutor().executeCommandOnAllNodes(cmd);
}

View File

@@ -29,6 +29,7 @@ import org.springframework.data.redis.util.ByteUtils;
/**
* @author Christoph Strobl
* @author Mark Paluch
* @since 2.0
*/
class LettuceClusterSetCommands extends LettuceSetCommands {
@@ -72,7 +73,7 @@ class LettuceClusterSetCommands extends LettuceSetCommands {
}
Collection<Set<byte[]>> nodeResult = connection.getClusterCommandExecutor()
.executeMuliKeyCommand((LettuceMultiKeyClusterCommandCallback<Set<byte[]>>) RedisSetCommands::smembers,
.executeMultiKeyCommand((LettuceMultiKeyClusterCommandCallback<Set<byte[]>>) RedisSetCommands::smembers,
Arrays.asList(keys))
.resultsAsList();
@@ -129,7 +130,7 @@ class LettuceClusterSetCommands extends LettuceSetCommands {
}
Collection<Set<byte[]>> nodeResult = connection.getClusterCommandExecutor()
.executeMuliKeyCommand((LettuceMultiKeyClusterCommandCallback<Set<byte[]>>) RedisSetCommands::smembers,
.executeMultiKeyCommand((LettuceMultiKeyClusterCommandCallback<Set<byte[]>>) RedisSetCommands::smembers,
Arrays.asList(keys))
.resultsAsList();
@@ -181,7 +182,7 @@ class LettuceClusterSetCommands extends LettuceSetCommands {
ByteArraySet values = new ByteArraySet(sMembers(source));
Collection<Set<byte[]>> nodeResult = connection.getClusterCommandExecutor()
.executeMuliKeyCommand((LettuceMultiKeyClusterCommandCallback<Set<byte[]>>) RedisSetCommands::smembers,
.executeMultiKeyCommand((LettuceMultiKeyClusterCommandCallback<Set<byte[]>>) RedisSetCommands::smembers,
Arrays.asList(others))
.resultsAsList();