Skip to content

Commit

Permalink
renamed a few variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jasobrown committed Jan 30, 2018
1 parent 106ba80 commit d1493c9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/java/org/apache/cassandra/net/MessagingService.java
Expand Up @@ -1716,7 +1716,7 @@ private void blockForPeers(int targetAlivePercent, int aliveTimeoutSecs)
logger.info("choosing to block until {}% of peers are marked alive; max time to wait = {} seconds", targetAlivePercent, aliveTimeoutSecs);

// first, send out a ping message to open up the non-gossip connections
AtomicInteger countdown = sendPingMessages(peers);
AtomicInteger connectedCount = sendPingMessages(peers);

long startNanos = System.nanoTime();
long expirationNanos = startNanos + TimeUnit.SECONDS.toNanos(aliveTimeoutSecs);
Expand All @@ -1731,15 +1731,15 @@ private void blockForPeers(int targetAlivePercent, int aliveTimeoutSecs)
}

float currentAlivePercent = ((float) currentAlive / (float) totalSize) * 100;
float currentConnectedPercent = ((float) countdown.get() / (float) totalSize) * 100;
float currentConnectedPercent = ((float) connectedCount.get() / (float) totalSize) * 100;
if (currentAlivePercent >= targetAlivePercent && currentConnectedPercent >= targetAlivePercent)
{
logger.info("after {} milliseconds, found {}% ({} / {}) of peers as marked alive, " +
"and {}% ({} / {}) of peers as connected, " +
"both of which are above the desired threshold of {}%",
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos),
currentAlivePercent, currentAlive, totalSize,
currentConnectedPercent, countdown.get(), totalSize,
currentConnectedPercent, connectedCount.get(), totalSize,
targetAlivePercent);
return;
}
Expand All @@ -1753,7 +1753,7 @@ private void blockForPeers(int targetAlivePercent, int aliveTimeoutSecs)
"one or both of which is below the desired threshold of {}%",
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos),
currentAlivePercent, currentAlive, totalSize,
currentConnectedPercent, countdown.get(), totalSize,
currentConnectedPercent, connectedCount.get(), totalSize,
targetAlivePercent);
return;
}
Expand All @@ -1763,7 +1763,7 @@ private void blockForPeers(int targetAlivePercent, int aliveTimeoutSecs)

private AtomicInteger sendPingMessages(Set<Map.Entry<InetAddressAndPort, EndpointState>> peers)
{
AtomicInteger countdown = new AtomicInteger(0);
AtomicInteger receivedCount = new AtomicInteger(0);
IAsyncCallback echoHandler = new IAsyncCallback()
{
@Override
Expand All @@ -1775,14 +1775,14 @@ public boolean isLatencyForSnitch()
@Override
public void response(MessageIn msg)
{
countdown.incrementAndGet();
receivedCount.incrementAndGet();
}
};

MessageOut<PingMessage> msg = new MessageOut<>(MessagingService.Verb.PING, PingMessage.instance, PingMessage.serializer);
for (Map.Entry<InetAddressAndPort, EndpointState> peer : peers)
MessagingService.instance().sendRR(msg, peer.getKey(), echoHandler);

return countdown;
return receivedCount;
}
}

0 comments on commit d1493c9

Please sign in to comment.