Feature - LoadBalancer.getEntry(List<ClientConnectionsEntry> clientsCopy, RedisCommand<?> redisCommand) method added

pull/4931/head
Nikita Koksharov 2 years ago
parent 63c0c7a481
commit 7cbd799241

@ -15,10 +15,11 @@
*/ */
package org.redisson.connection.balancer; package org.redisson.connection.balancer;
import java.util.List; import org.redisson.client.protocol.RedisCommand;
import org.redisson.connection.ClientConnectionsEntry; import org.redisson.connection.ClientConnectionsEntry;
import java.util.List;
/** /**
* *
* @author Nikita Koksharov * @author Nikita Koksharov
@ -26,6 +27,14 @@ import org.redisson.connection.ClientConnectionsEntry;
*/ */
public interface LoadBalancer { public interface LoadBalancer {
/*
* Use getEntry(List<ClientConnectionsEntry> clientsCopy, RedisCommand<?> redisCommand) method instead
*/
@Deprecated
ClientConnectionsEntry getEntry(List<ClientConnectionsEntry> clientsCopy); ClientConnectionsEntry getEntry(List<ClientConnectionsEntry> clientsCopy);
default ClientConnectionsEntry getEntry(List<ClientConnectionsEntry> clientsCopy, RedisCommand<?> redisCommand) {
return getEntry(clientsCopy);
}
} }

@ -186,7 +186,7 @@ abstract class ConnectionPool<T extends RedisConnection> {
} }
} }
if (!entriesCopy.isEmpty()) { if (!entriesCopy.isEmpty()) {
ClientConnectionsEntry entry = config.getLoadBalancer().getEntry(entriesCopy); ClientConnectionsEntry entry = config.getLoadBalancer().getEntry(entriesCopy, command);
return acquireConnection(command, entry); return acquireConnection(command, entry);
} }

@ -39,7 +39,7 @@ public class PubSubConnectionPool extends ConnectionPool<RedisPubSubConnection>
} }
public CompletableFuture<RedisPubSubConnection> get() { public CompletableFuture<RedisPubSubConnection> get() {
return get(RedisCommands.PUBLISH); return get(RedisCommands.SUBSCRIBE);
} }
@Override @Override

Loading…
Cancel
Save