Spring Data Redis refactoring

pull/6394/head
Nikita Koksharov 3 weeks ago
parent 28017b6c8b
commit 3b7e13a8eb

@ -15,7 +15,6 @@
*/ */
package org.redisson.spring.data.connection; package org.redisson.spring.data.connection;
import io.netty.util.CharsetUtil;
import org.redisson.api.BatchResult; import org.redisson.api.BatchResult;
import org.redisson.api.RFuture; import org.redisson.api.RFuture;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
@ -381,7 +380,7 @@ public class RedissonClusterConnection extends RedissonConnection implements Red
throw new InvalidDataAccessResourceUsageException("Clustered rename is not supported in a pipeline"); throw new InvalidDataAccessResourceUsageException("Clustered rename is not supported in a pipeline");
} }
if (redisson.getConnectionManager().calcSlot(oldName) == redisson.getConnectionManager().calcSlot(newName)) { if (executorService.getConnectionManager().calcSlot(oldName) == executorService.getConnectionManager().calcSlot(newName)) {
super.rename(oldName, newName); super.rename(oldName, newName);
return; return;
} }
@ -410,7 +409,7 @@ public class RedissonClusterConnection extends RedissonConnection implements Red
throw new InvalidDataAccessResourceUsageException("Clustered rename is not supported in a pipeline"); throw new InvalidDataAccessResourceUsageException("Clustered rename is not supported in a pipeline");
} }
if (redisson.getConnectionManager().calcSlot(oldName) == redisson.getConnectionManager().calcSlot(newName)) { if (executorService.getConnectionManager().calcSlot(oldName) == executorService.getConnectionManager().calcSlot(newName)) {
return super.renameNX(oldName, newName); return super.renameNX(oldName, newName);
} }

@ -258,7 +258,7 @@ public class RedissonConnection extends AbstractRedisConnection {
return new ScanCursor<byte[]>(0, options) { return new ScanCursor<byte[]>(0, options) {
private RedisClient client; private RedisClient client;
private Iterator<MasterSlaveEntry> entries = redisson.getConnectionManager().getEntrySet().iterator(); private Iterator<MasterSlaveEntry> entries = executorService.getConnectionManager().getEntrySet().iterator();
private MasterSlaveEntry entry = entries.next(); private MasterSlaveEntry entry = entries.next();
@Override @Override
@ -1606,7 +1606,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void subscribe(MessageListener listener, byte[]... channels) { public void subscribe(MessageListener listener, byte[]... channels) {
checkSubscription(); checkSubscription();
subscription = new RedissonSubscription(executorService, redisson.getConnectionManager().getSubscribeService(), listener); subscription = new RedissonSubscription(executorService, listener);
subscription.subscribe(channels); subscription.subscribe(channels);
} }
@ -1627,7 +1627,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void pSubscribe(MessageListener listener, byte[]... patterns) { public void pSubscribe(MessageListener listener, byte[]... patterns) {
checkSubscription(); checkSubscription();
subscription = new RedissonSubscription(executorService, redisson.getConnectionManager().getSubscribeService(), listener); subscription = new RedissonSubscription(executorService, listener);
subscription.pSubscribe(patterns); subscription.pSubscribe(patterns);
} }

@ -42,10 +42,10 @@ public class RedissonSubscription extends AbstractSubscription {
private final CommandAsyncExecutor commandExecutor; private final CommandAsyncExecutor commandExecutor;
private final PublishSubscribeService subscribeService; private final PublishSubscribeService subscribeService;
public RedissonSubscription(CommandAsyncExecutor commandExecutor, PublishSubscribeService subscribeService, MessageListener listener) { public RedissonSubscription(CommandAsyncExecutor commandExecutor, MessageListener listener) {
super(listener, null, null); super(listener, null, null);
this.commandExecutor = commandExecutor; this.commandExecutor = commandExecutor;
this.subscribeService = subscribeService; this.subscribeService = commandExecutor.getConnectionManager().getSubscribeService();
} }
@Override @Override

Loading…
Cancel
Save