diff --git a/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java b/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java index 55fc80e75..fb73cf0e5 100644 --- a/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java +++ b/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java @@ -23,6 +23,7 @@ import org.redisson.client.protocol.RedisCommand; import org.redisson.config.MasterSlaveServersConfig; import org.redisson.config.ReadMode; import org.redisson.misc.AsyncSemaphore; +import org.redisson.misc.WrappedLock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,7 +63,7 @@ public class ClientConnectionsEntry { private volatile boolean initialized = false; - private final AsyncSemaphore lock = new AsyncSemaphore(1); + private final WrappedLock lock = new WrappedLock(); public ClientConnectionsEntry(RedisClient client, int poolMinSize, int poolMaxSize, IdleConnectionWatcher idleConnectionWatcher, NodeType nodeType, MasterSlaveServersConfig config) { @@ -242,7 +243,7 @@ public class ClientConnectionsEntry { freeSubscribeConnectionsCounter.release(); } - public AsyncSemaphore getLock() { + public WrappedLock getLock() { return lock; } diff --git a/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java b/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java index f7545a0dc..65134d79a 100644 --- a/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java +++ b/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java @@ -229,7 +229,7 @@ public class MasterSlaveEntry { return false; } return true; - }).join(); + }); if (!res) { return; } @@ -241,7 +241,7 @@ public class MasterSlaveEntry { return false; } return true; - }).join(); + }); if (!res2) { return; } @@ -264,7 +264,7 @@ public class MasterSlaveEntry { return false; } return true; - }).join(); + }); if (!res3) { return; } @@ -461,7 +461,7 @@ public class MasterSlaveEntry { if (freezed) { entry.getLock().execute(() -> { entry.setFreezeReason(FreezeReason.SYSTEM); - }).join(); + }); } return slaveBalancer.add(entry); }).whenComplete((r, ex) -> { @@ -618,7 +618,7 @@ public class MasterSlaveEntry { oldMaster.getLock().execute(() -> { oldMaster.setFreezeReason(FreezeReason.MANAGER); - }).join(); + }); nodeDown(oldMaster); slaveBalancer.changeType(oldMaster.getClient().getAddr(), NodeType.SLAVE); diff --git a/redisson/src/main/java/org/redisson/connection/balancer/LoadBalancerManager.java b/redisson/src/main/java/org/redisson/connection/balancer/LoadBalancerManager.java index 6198eb095..6e310953c 100644 --- a/redisson/src/main/java/org/redisson/connection/balancer/LoadBalancerManager.java +++ b/redisson/src/main/java/org/redisson/connection/balancer/LoadBalancerManager.java @@ -171,7 +171,7 @@ public class LoadBalancerManager { } } return CompletableFuture.completedFuture(false); - }).join(); + }); } public ClientConnectionsEntry freeze(RedisURI address, FreezeReason freezeReason) { @@ -207,7 +207,7 @@ public class LoadBalancerManager { return connectionEntry; } return connectionEntry; - }).join(); + }); } public CompletableFuture nextPubSubConnection() {