@Override
RedisPubSubConnection nextPubSubConnection() {
acquireSubscribeConnection();
RedisPubSubConnection conn = ((SubscribesConnectionEntry)masterEntry).pollFreeSubscribeConnection();
if (conn != null) {
return conn;
}
try {
conn = masterEntry.getClient().connectPubSub(codec);
if (config.getPassword() != null) {
conn.auth(config.getPassword());
}
if (config.getDatabase() != 0) {
conn.select(config.getDatabase());
}
return conn;
} catch (RedisConnectionException e) {
((SubscribesConnectionEntry)masterEntry).getSubscribeConnectionsSemaphore().release();
throw e;