diff --git a/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java b/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java index d4e2b2ad4..03eeee27d 100644 --- a/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java +++ b/other/java/client/src/main/java/seaweedfs/client/FilerGrpcClient.java @@ -124,7 +124,8 @@ public class FilerGrpcClient { // Get a channel from the pool using round-robin private ManagedChannel getChannel() { - int index = Math.abs(channelIndex.getAndIncrement() % CHANNEL_POOL_SIZE); + int raw = channelIndex.getAndIncrement(); + int index = Math.floorMod(raw, CHANNEL_POOL_SIZE); return channelPool.get(index); }