From 9064abcfd8aa9d38de71b90657bf72d34aa730da Mon Sep 17 00:00:00 2001 From: Artem Vysochyn Date: Wed, 26 Jun 2024 13:53:17 +0300 Subject: [PATCH] Cosmetic changes --- .../src/main/java/io/scalecube/cluster2/AbstractAgent.java | 2 +- .../io/scalecube/cluster2/fdetector/FailureDetector.java | 2 +- .../java/io/scalecube/cluster2/gossip/GossipProtocol.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cluster2/src/main/java/io/scalecube/cluster2/AbstractAgent.java b/cluster2/src/main/java/io/scalecube/cluster2/AbstractAgent.java index 783c372b..efb9be88 100644 --- a/cluster2/src/main/java/io/scalecube/cluster2/AbstractAgent.java +++ b/cluster2/src/main/java/io/scalecube/cluster2/AbstractAgent.java @@ -109,7 +109,7 @@ private int processExpiredCalls() { } } - for (int n = expiredCalls.size() - 1, i = n; i >= 0; i--) { + for (int n = expiredCalls.size(), i = n - 1; i >= 0; i--) { invokeCallback(expiredCalls.fastUnorderedRemove(i), null); } diff --git a/cluster2/src/main/java/io/scalecube/cluster2/fdetector/FailureDetector.java b/cluster2/src/main/java/io/scalecube/cluster2/fdetector/FailureDetector.java index 2a77f2a2..796da9b7 100644 --- a/cluster2/src/main/java/io/scalecube/cluster2/fdetector/FailureDetector.java +++ b/cluster2/src/main/java/io/scalecube/cluster2/fdetector/FailureDetector.java @@ -119,7 +119,7 @@ private void nextPingReqMembers(Member pingMember) { } private void doPingRequest(Member pingMember) { - for (int n = pingReqMembers.size() - 1, i = n; i >= 0; i--) { + for (int n = pingReqMembers.size(), i = n - 1; i >= 0; i--) { final Member member = pingReqMembers.get(i); ArrayListUtil.fastUnorderedRemove(pingReqMembers, i); diff --git a/cluster2/src/main/java/io/scalecube/cluster2/gossip/GossipProtocol.java b/cluster2/src/main/java/io/scalecube/cluster2/gossip/GossipProtocol.java index 7b844da5..3ae9dc60 100644 --- a/cluster2/src/main/java/io/scalecube/cluster2/gossip/GossipProtocol.java +++ b/cluster2/src/main/java/io/scalecube/cluster2/gossip/GossipProtocol.java @@ -88,7 +88,7 @@ protected void onTick() { nextGossipMembers(); - for (int n = gossipMembers.size() - 1, i = n; i >= 0; i--) { + for (int n = gossipMembers.size(), i = n - 1; i >= 0; i--) { final Member member = gossipMembers.get(i); ArrayListUtil.fastUnorderedRemove(gossipMembers, i); spreadGossips(period, member); @@ -98,7 +98,7 @@ protected void onTick() { nextGossipsToRemove(period); - for (int n = gossipsToRemove.size() - 1, i = n; i >= 0; i--) { + for (int n = gossipsToRemove.size(), i = n - 1; i >= 0; i--) { final int index = gossipsToRemove.fastUnorderedRemove(i); ArrayListUtil.fastUnorderedRemove(gossips, index); } @@ -155,7 +155,7 @@ private void spreadGossips(long period, Member member) { final String address = member.address(); final UUID from = localMember.id(); - for (int n = gossipsToSend.size() - 1, i = n; i >= 0; i--) { + for (int n = gossipsToSend.size(), i = n - 1; i >= 0; i--) { final Gossip gossip = gossips.get(gossipsToSend.fastUnorderedRemove(i)); transport.send( address, gossipRequestCodec.encode(from, gossip), 0, gossipRequestCodec.encodedLength());