Remove listeners during slave down process handling. #945

pull/1071/head
Nikita 7 years ago
parent 7d6fd352df
commit 1212b39f5b

@ -112,6 +112,11 @@ public class ClientConnectionsEntry {
this.freezed = freezed; this.freezed = freezed;
} }
public void reset() {
freeConnectionsCounter.removeListeners();
freeSubscribeConnectionsCounter.removeListeners();
}
public int getFreeAmount() { public int getFreeAmount() {
return freeConnectionsCounter.getCounter(); return freeConnectionsCounter.getCounter();
} }

@ -143,6 +143,8 @@ public class MasterSlaveEntry {
} }
} }
entry.reset();
// close all connections // close all connections
while (true) { while (true) {
final RedisConnection connection = entry.pollConnection(); final RedisConnection connection = entry.pollConnection();

@ -17,8 +17,6 @@ package org.redisson.pubsub;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -58,6 +56,12 @@ public class AsyncSemaphore {
} }
} }
public void removeListeners() {
synchronized (this) {
listeners.clear();
}
}
public void acquire(Runnable listener) { public void acquire(Runnable listener) {
boolean run = false; boolean run = false;

Loading…
Cancel
Save