diff --git a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java index 31fd12e42..00e3d989f 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java @@ -31,6 +31,7 @@ public abstract class AtomicCountersParam { JedisConnectionFactory jedisConnFactory = new JedisConnectionFactory(); jedisConnFactory.setPort(SettingsUtils.getPort()); jedisConnFactory.setHostName(SettingsUtils.getHost()); + jedisConnFactory.setUsePool(false); jedisConnFactory.afterPropertiesSet(); // jredis factory diff --git a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java index 059993d34..5557a9f56 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.Collection; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.After; @@ -121,7 +122,9 @@ public class RedisAtomicTests { @Test public void testCompareSet() throws Exception { final AtomicBoolean flag = new AtomicBoolean(false); - for (int i = 0; i < 500; i++) { + int NUM = 123; + final CountDownLatch latch = new CountDownLatch(NUM); + for (int i = 0; i < NUM; i++) { new Thread(new Runnable() { public void run() { RedisAtomicInteger atomicInteger = new RedisAtomicInteger("key", factory); @@ -132,9 +135,10 @@ public class RedisAtomicTests { flag.set(true); } + latch.countDown(); } - }).start(); } + latch.await(); } } \ No newline at end of file