Improvement - Virtual Threads compatibility #5499

pull/5520/head
Nikita Koksharov 1 year ago
parent 103e16eee4
commit 0e7bee4fe3

@ -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;
}

@ -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);

@ -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<RedisPubSubConnection> nextPubSubConnection() {

Loading…
Cancel
Save