Speed up Sentinel related tests

* remove FIXME sleep codes for Sentinel related tests
** add functions for Sentinel tests (JedisSentinelTestUtil)
*** waitForSentinelRecognizeRedisReplication
*** waitForNewPromotedMaster
*** waitForSentinelsRecognizeEachOthers
**** TODO: there're no command for sentinel to list recognized sentinel
**** sleep 5.5 sec (sentinel pings to master every 5 sec)

* set HostAndPort class to public(no longer inner) class
** reason: We cannot know pool's current master if HostAndPort class is
private inner class / HostAndPort classes are duplicated (main/test)
** make getter method and parameterized constructor
*** set fields once, get anytime
This commit is contained in:
Jungtaek Lim
2013-10-07 11:03:32 +09:00
parent 597366343d
commit 7e1a1a70b2
19 changed files with 431 additions and 259 deletions

View File

@@ -6,17 +6,17 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.pool.impl.GenericObjectPool.Config;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.tests.HostAndPortUtil;
import redis.clients.jedis.tests.HostAndPortUtil.HostAndPort;
public class PoolBenchmark {
private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0);
private static final int TOTAL_OPERATIONS = 100000;
public static void main(String[] args) throws Exception {
Jedis j = new Jedis(hnp.host, hnp.port);
Jedis j = new Jedis(hnp.getHost(), hnp.getPort());
j.connect();
j.auth("foobared");
j.flushAll();
@@ -30,7 +30,7 @@ public class PoolBenchmark {
}
private static void withPool() throws Exception {
final JedisPool pool = new JedisPool(new Config(), hnp.host, hnp.port,
final JedisPool pool = new JedisPool(new Config(), hnp.getHost(), hnp.getPort(),
2000, "foobared");
List<Thread> tds = new ArrayList<Thread>();