refactoring

pull/5757/head
Nikita Koksharov 12 months ago
parent 704f142f1a
commit 06a0b0ab5a

@ -127,7 +127,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1453,13 +1453,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -144,7 +144,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1496,13 +1496,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -147,7 +147,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1509,13 +1509,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -132,7 +132,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1511,13 +1511,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -130,7 +130,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1514,13 +1514,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -130,7 +130,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1513,13 +1513,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -130,7 +130,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1514,13 +1514,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -130,7 +130,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1538,13 +1538,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -130,7 +130,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1578,13 +1578,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -135,7 +135,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1583,13 +1583,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -135,7 +135,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1583,13 +1583,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -139,7 +139,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1510,13 +1510,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -139,7 +139,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1510,13 +1510,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -139,7 +139,7 @@ public class RedissonConnection extends AbstractRedisConnection {
public void openPipeline() {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override
@ -1510,13 +1510,13 @@ public class RedissonConnection extends AbstractRedisConnection {
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
return;
}
BatchOptions options = BatchOptions.defaults()
.executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
this.executorService = executorService.createCommandBatchService(options);
}
@Override

@ -34,7 +34,7 @@ public class RedissonBatch implements RBatch {
private final CommandBatchService executorService;
public RedissonBatch(EvictionScheduler evictionScheduler, CommandAsyncExecutor executor, BatchOptions options) {
this.executorService = new CommandBatchService(executor, options);
this.executorService = executor.createCommandBatchService(options);
this.evictionScheduler = evictionScheduler;
}

@ -17,6 +17,7 @@ package org.redisson.command;
import io.netty.buffer.ByteBuf;
import org.redisson.SlotCallback;
import org.redisson.api.BatchOptions;
import org.redisson.api.RFuture;
import org.redisson.api.options.ObjectParams;
import org.redisson.client.RedisClient;
@ -159,4 +160,6 @@ public interface CommandAsyncExecutor {
boolean isTrackChanges();
CommandBatchService createCommandBatchService(BatchOptions options);
}

@ -1024,6 +1024,11 @@ public class CommandAsyncService implements CommandAsyncExecutor {
protected CommandBatchService createCommandBatchService(int availableSlaves) {
BatchOptions options = BatchOptions.defaults()
.sync(availableSlaves, Duration.ofMillis(getServiceManager().getCfg().getSlavesSyncTimeout()));
return createCommandBatchService(options);
}
@Override
public CommandBatchService createCommandBatchService(BatchOptions options) {
return new CommandBatchService(this, options);
}

@ -209,7 +209,7 @@ public class RedissonTransaction implements RTransaction {
BatchOptions batchOptions = createOptions();
CommandBatchService transactionExecutor = new CommandBatchService(commandExecutor, batchOptions);
CommandBatchService transactionExecutor = commandExecutor.createCommandBatchService(batchOptions);
for (TransactionalOperation transactionalOperation : operations) {
transactionalOperation.commit(transactionExecutor);
}
@ -278,7 +278,7 @@ public class RedissonTransaction implements RTransaction {
BatchOptions batchOptions = createOptions();
CommandBatchService transactionExecutor = new CommandBatchService(commandExecutor, batchOptions);
CommandBatchService transactionExecutor = commandExecutor.createCommandBatchService(batchOptions);
for (TransactionalOperation transactionalOperation : operations) {
transactionalOperation.commit(transactionExecutor);
}

Loading…
Cancel
Save