|
|
@ -3,11 +3,17 @@ package org.redisson;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.net.InetSocketAddress;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
|
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
import java.util.concurrent.Executors;
|
|
|
@ -22,13 +28,17 @@ import org.junit.runner.RunWith;
|
|
|
|
import org.junit.runners.Parameterized;
|
|
|
|
import org.junit.runners.Parameterized;
|
|
|
|
import org.redisson.ClusterRunner.ClusterProcesses;
|
|
|
|
import org.redisson.ClusterRunner.ClusterProcesses;
|
|
|
|
import org.redisson.RedisRunner.FailedToStartRedisException;
|
|
|
|
import org.redisson.RedisRunner.FailedToStartRedisException;
|
|
|
|
|
|
|
|
import org.redisson.RedisRunner.RedisProcess;
|
|
|
|
import org.redisson.api.BatchOptions;
|
|
|
|
import org.redisson.api.BatchOptions;
|
|
|
|
import org.redisson.api.BatchOptions.ExecutionMode;
|
|
|
|
import org.redisson.api.BatchOptions.ExecutionMode;
|
|
|
|
import org.redisson.api.BatchResult;
|
|
|
|
import org.redisson.api.BatchResult;
|
|
|
|
|
|
|
|
import org.redisson.api.ClusterNode;
|
|
|
|
|
|
|
|
import org.redisson.api.NodeType;
|
|
|
|
import org.redisson.api.RBatch;
|
|
|
|
import org.redisson.api.RBatch;
|
|
|
|
import org.redisson.api.RBucket;
|
|
|
|
import org.redisson.api.RBucket;
|
|
|
|
import org.redisson.api.RFuture;
|
|
|
|
import org.redisson.api.RFuture;
|
|
|
|
import org.redisson.api.RListAsync;
|
|
|
|
import org.redisson.api.RListAsync;
|
|
|
|
|
|
|
|
import org.redisson.api.RMap;
|
|
|
|
import org.redisson.api.RMapAsync;
|
|
|
|
import org.redisson.api.RMapAsync;
|
|
|
|
import org.redisson.api.RMapCacheAsync;
|
|
|
|
import org.redisson.api.RMapCacheAsync;
|
|
|
|
import org.redisson.api.RScoredSortedSet;
|
|
|
|
import org.redisson.api.RScoredSortedSet;
|
|
|
@ -38,6 +48,7 @@ import org.redisson.api.RedissonClient;
|
|
|
|
import org.redisson.client.RedisException;
|
|
|
|
import org.redisson.client.RedisException;
|
|
|
|
import org.redisson.client.codec.StringCodec;
|
|
|
|
import org.redisson.client.codec.StringCodec;
|
|
|
|
import org.redisson.config.Config;
|
|
|
|
import org.redisson.config.Config;
|
|
|
|
|
|
|
|
import org.redisson.config.ReadMode;
|
|
|
|
|
|
|
|
|
|
|
|
@RunWith(Parameterized.class)
|
|
|
|
@RunWith(Parameterized.class)
|
|
|
|
public class RedissonBatchTest extends BaseTest {
|
|
|
|
public class RedissonBatchTest extends BaseTest {
|
|
|
@ -106,6 +117,27 @@ public class RedissonBatchTest extends BaseTest {
|
|
|
|
assertThat(b2f2.get()).isEqualTo(2d);
|
|
|
|
assertThat(b2f2.get()).isEqualTo(2d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test(timeout = 18000)
|
|
|
|
|
|
|
|
public void testPerformance() {
|
|
|
|
|
|
|
|
RMap<String, String> map = redisson.getMap("map");
|
|
|
|
|
|
|
|
Map<String, String> m = new HashMap<String, String>();
|
|
|
|
|
|
|
|
for (int j = 0; j < 1000; j++) {
|
|
|
|
|
|
|
|
m.put("" + j, "" + j);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
map.putAll(m);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10000; i++) {
|
|
|
|
|
|
|
|
RBatch rBatch = redisson.createBatch();
|
|
|
|
|
|
|
|
RMapAsync<String, String> m1 = rBatch.getMap("map");
|
|
|
|
|
|
|
|
m1.getAllAsync(m.keySet());
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
rBatch.execute();
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testConnectionLeakAfterError() throws InterruptedException {
|
|
|
|
public void testConnectionLeakAfterError() throws InterruptedException {
|
|
|
|
Config config = createConfig();
|
|
|
|
Config config = createConfig();
|
|
|
|