use of org.redisson.api.BatchOptions in project redisson by redisson.
the class RedissonConnection method multi.
@Override
public void multi() {
if (isQueueing()) {
return;
}
if (isPipelined()) {
BatchOptions options = BatchOptions.defaults().executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
return;
}
BatchOptions options = BatchOptions.defaults().executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
this.executorService = new CommandBatchService(executorService, options);
}
use of org.redisson.api.BatchOptions in project redisson by redisson.
the class RedissonConnection method openPipeline.
@Override
public void openPipeline() {
BatchOptions options = BatchOptions.defaults().executionMode(ExecutionMode.IN_MEMORY);
this.executorService = new CommandBatchService(executorService, options);
}
use of org.redisson.api.BatchOptions in project redisson by redisson.
the class RedissonBatchRxTest method testConnectionLeakAfterError.
@Test
public void testConnectionLeakAfterError() {
Config config = BaseTest.createConfig();
config.useSingleServer().setRetryInterval(100).setTimeout(200).setConnectionMinimumIdleSize(1).setConnectionPoolSize(1);
RedissonRxClient redisson = Redisson.create(config).rxJava();
BatchOptions batchOptions = BatchOptions.defaults().executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
RBatchRx batch = redisson.createBatch(batchOptions);
for (int i = 0; i < 25000; i++) {
batch.getBucket("test").set(123);
}
try {
sync(batch.execute());
Assertions.fail();
} catch (Exception e) {
// skip
}
sync(redisson.getBucket("test3").set(4));
assertThat(sync(redisson.getBucket("test3").get())).isEqualTo(4);
batch = redisson.createBatch(batchOptions);
batch.getBucket("test1").set(1);
batch.getBucket("test2").set(2);
sync(batch.execute());
assertThat(sync(redisson.getBucket("test1").get())).isEqualTo(1);
assertThat(sync(redisson.getBucket("test2").get())).isEqualTo(2);
redisson.shutdown();
}
Aggregations