Github user aweisberg commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/224#discussion_r188685170
--- Diff: src/java/org/apache/cassandra/service/StorageService.java ---
@@ -3863,17 +3863,12 @@ public void forceTerminateAllRepairSessions()
*
* @param keyspace keyspace name also known as keyspace
* @param pos position for which we need to find the endpoint
- * @param liveEps the list of endpoints to mutate
*/
- public void getLiveNaturalEndpoints(Keyspace keyspace, RingPosition
pos, List<InetAddressAndPort> liveEps)
+ public ReplicaList getLiveNaturalReplicas(Keyspace keyspace,
RingPosition pos)
{
- List<InetAddressAndPort> endpoints =
keyspace.getReplicationStrategy().getNaturalEndpoints(pos);
+ ReplicaList replicas =
keyspace.getReplicationStrategy().getNaturalReplicas(pos);
- for (InetAddressAndPort endpoint : endpoints)
- {
- if (FailureDetector.instance.isAlive(endpoint))
- liveEps.add(endpoint);
- }
+ return replicas.filter(r ->
FailureDetector.instance.isAlive(r.getEndpoint()));
--- End diff --
if isAlive were static you wouldn't have to allocate lambda here.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]