Skip to content

Commit

Permalink
Use read-only view when consuming Partitions #1252
Browse files Browse the repository at this point in the history
The node-selection API now uses the read-only view instead of the mutable partitions view when consuming the topology view.
  • Loading branch information
mp911de committed Apr 1, 2020
1 parent 15a90d8 commit 53edfce
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ protected CompletableFuture<API> getApi(RedisClusterNode redisClusterNode) {

@Override
protected List<RedisClusterNode> nodes() {
return writer.getPartitions().getPartitions().stream().filter(selector).collect(Collectors.toList());
return writer.getPartitions().stream().filter(selector).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static class StaticPubSubAsyncNodeSelection<K, V>
public StaticPubSubAsyncNodeSelection(StatefulRedisClusterPubSubConnection<K, V> globalConnection,
Predicate<RedisClusterNode> selector) {

this.redisClusterNodes = globalConnection.getPartitions().getPartitions().stream().filter(selector)
this.redisClusterNodes = globalConnection.getPartitions().stream().filter(selector)
.collect(Collectors.toList());
writer = ((StatefulRedisClusterPubSubConnectionImpl) globalConnection).getClusterDistributionChannelWriter();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private static class StaticPubSubReactiveNodeSelection<K, V>
public StaticPubSubReactiveNodeSelection(StatefulRedisClusterPubSubConnection<K, V> globalConnection,
Predicate<RedisClusterNode> selector) {

this.redisClusterNodes = globalConnection.getPartitions().getPartitions().stream().filter(selector)
this.redisClusterNodes = globalConnection.getPartitions().stream().filter(selector)
.collect(Collectors.toList());
writer = ((StatefulRedisClusterPubSubConnectionImpl) globalConnection).getClusterDistributionChannelWriter();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public StaticNodeSelection(ClusterDistributionChannelWriter writer, Predicate<Re
this.intent = intent;
this.apiExtractor = apiExtractor;

this.redisClusterNodes = writer.getPartitions().getPartitions().stream().filter(selector).collect(Collectors.toList());
this.redisClusterNodes = writer.getPartitions().stream().filter(selector).collect(Collectors.toList());
}

@Override
Expand Down

0 comments on commit 53edfce

Please sign in to comment.