Merge pull request #3455 from mikawudi/fix-reconnect

fix: ClientConnectionsEntry reconnect error
pull/3245/merge
Nikita Koksharov 4 years ago committed by GitHub
commit d0ee3ac486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,6 +20,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiConsumer;
import org.redisson.api.NodeType;
@ -148,9 +149,18 @@ public class LoadBalancerManager {
}
};
listener.setCounter(2);
BiConsumer<Void, Throwable> initCallBack = (r, ex) -> {
if (ex == null) {
listener.decCounter();
BiConsumer<Void, Throwable> initCallBack = new BiConsumer<Void, Throwable>() {
private AtomicBoolean initConnError = new AtomicBoolean(false);
@Override
public void accept(Void r, Throwable ex) {
if (ex == null) {
listener.decCounter();
} else {
if (!initConnError.compareAndSet(false, true)) {
return;
}
entry.setInitialized(false);
}
}
};
entry.resetFirstFail();
@ -162,7 +172,7 @@ public class LoadBalancerManager {
}
return false;
}
public ClientConnectionsEntry freeze(RedisURI address, FreezeReason freezeReason) {
ClientConnectionsEntry connectionEntry = getEntry(address);
return freeze(connectionEntry, freezeReason);

Loading…
Cancel
Save