@SuppressWarnings({ "unchecked", "hiding", "rawtypes" })
public <K, V> RedisAsyncConnectionImpl<K, V> getConnection(Intent intent, int slot) {
logger.debug("getConnection(" + intent + ", " + slot + ")");
RedisClusterNode partition = partitions.getPartitionBySlot(slot);
if (partition == null) {
throw new RedisException("Cannot determine a partition for slot " + slot + " (Partitions: " + partitions + ")");
}
try {
PoolKey key = new PoolKey(intent, partition.getUri());
RedisAsyncConnection connection = partitionPool.borrowObject(key);
partitionPool.returnObject(key, connection);
return (RedisAsyncConnectionImpl<K, V>) connection;
} catch (Exception e) {
throw new RedisException(e);
}
}