|
|
|
@ -139,25 +139,25 @@ public class MasterSlaveEntry {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
masterEntry = new ClientConnectionsEntry(
|
|
|
|
|
client,
|
|
|
|
|
config.getMasterConnectionMinimumIdleSize(),
|
|
|
|
|
config.getMasterConnectionPoolSize(),
|
|
|
|
|
config.getSubscriptionConnectionMinimumIdleSize(),
|
|
|
|
|
config.getSubscriptionConnectionPoolSize(),
|
|
|
|
|
connectionManager,
|
|
|
|
|
masterEntry = new ClientConnectionsEntry(
|
|
|
|
|
client,
|
|
|
|
|
config.getMasterConnectionMinimumIdleSize(),
|
|
|
|
|
config.getMasterConnectionPoolSize(),
|
|
|
|
|
config.getSubscriptionConnectionMinimumIdleSize(),
|
|
|
|
|
config.getSubscriptionConnectionPoolSize(),
|
|
|
|
|
connectionManager,
|
|
|
|
|
NodeType.MASTER);
|
|
|
|
|
|
|
|
|
|
CountableListener<RedisClient> listener = new CountableListener<RedisClient>(result, client);
|
|
|
|
|
RFuture<Void> writeFuture = writeConnectionPool.add(masterEntry);
|
|
|
|
|
listener.incCounter();
|
|
|
|
|
writeFuture.addListener(listener);
|
|
|
|
|
CountableListener<RedisClient> listener = new CountableListener<RedisClient>(result, client);
|
|
|
|
|
RFuture<Void> writeFuture = writeConnectionPool.add(masterEntry);
|
|
|
|
|
listener.incCounter();
|
|
|
|
|
writeFuture.addListener(listener);
|
|
|
|
|
|
|
|
|
|
if (config.getSubscriptionMode() == SubscriptionMode.MASTER) {
|
|
|
|
|
RFuture<Void> pubSubFuture = pubSubConnectionPool.add(masterEntry);
|
|
|
|
|
listener.incCounter();
|
|
|
|
|
pubSubFuture.addListener(listener);
|
|
|
|
|
}
|
|
|
|
|
if (config.getSubscriptionMode() == SubscriptionMode.MASTER) {
|
|
|
|
|
RFuture<Void> pubSubFuture = pubSubConnectionPool.add(masterEntry);
|
|
|
|
|
listener.incCounter();
|
|
|
|
|
pubSubFuture.addListener(listener);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -346,6 +346,10 @@ public class MasterSlaveEntry {
|
|
|
|
|
return addSlave(client, freezed, nodeType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ClientConnectionsEntry getSlaveEntry(RedisClient client) {
|
|
|
|
|
return slaveBalancer.getEntry(client);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Collection<ClientConnectionsEntry> getSlaveEntries() {
|
|
|
|
|
List<ClientConnectionsEntry> result = new ArrayList<ClientConnectionsEntry>();
|
|
|
|
|
for (ClientConnectionsEntry slaveEntry : slaveBalancer.getEntries()) {
|
|
|
|
@ -467,22 +471,6 @@ public class MasterSlaveEntry {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isFreezed() {
|
|
|
|
|
return masterEntry.isFreezed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public FreezeReason getFreezeReason() {
|
|
|
|
|
return masterEntry.getFreezeReason();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void unfreeze() {
|
|
|
|
|
masterEntry.resetFirstFail();
|
|
|
|
|
synchronized (masterEntry) {
|
|
|
|
|
masterEntry.setFreezed(false);
|
|
|
|
|
masterEntry.setFreezeReason(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void shutdownMasterAsync() {
|
|
|
|
|
if (!active.compareAndSet(true, false)) {
|
|
|
|
|
return;
|
|
|
|
|