ARTEMIS-3547 remove first field to improve code

first field is not necessary here, only pos field can work.
So remove first here.
This commit is contained in:
domson-tech 2021-11-01 20:53:15 +08:00 committed by Clebert Suconic
parent c6b85ea4e3
commit 89253b8513
1 changed files with 2 additions and 5 deletions

View File

@ -31,17 +31,14 @@ public final class RoundRobinConnectionLoadBalancingPolicy implements Connection
private static final long serialVersionUID = 7511196010141439559L;
private boolean first = true;
private int pos;
private int pos = -1;
@Override
public int select(final int max) {
if (first) {
if (pos == -1) {
// We start on a random one
pos = RandomUtil.randomInterval(0, max);
first = false;
} else {
pos++;