Merge branch 'speed-up-unit-test' of github.com:HeartSaVioR/jedis into upgrade_libs

Conflicts:
	src/test/java/redis/clients/jedis/tests/JedisPoolTest.java
	src/test/java/redis/clients/jedis/tests/JedisSentinelPoolTest.java
	src/test/java/redis/clients/jedis/tests/JedisSentinelTest.java
	src/test/java/redis/clients/jedis/tests/ShardedJedisPipelineTest.java
	src/test/java/redis/clients/jedis/tests/ShardedJedisPoolTest.java
	src/test/java/redis/clients/jedis/tests/benchmark/PoolBenchmark.java
	src/test/java/redis/clients/jedis/tests/commands/TransactionCommandsTest.java
This commit is contained in:
Jonathan Leibiusky
2013-11-29 12:12:30 -05:00
23 changed files with 400 additions and 246 deletions

View File

@@ -82,25 +82,6 @@ public class JedisSentinelPool extends Pool<Jedis> {
returnResourceObject(resource);
}
private class HostAndPort {
String host;
int port;
@Override
public boolean equals(Object obj) {
if (obj instanceof HostAndPort) {
HostAndPort hp = (HostAndPort) obj;
return port == hp.port && host.equals(hp.host);
}
return false;
}
@Override
public String toString() {
return host + ":" + port;
}
}
private volatile HostAndPort currentHostMaster;
public void destroy() {
@@ -119,7 +100,7 @@ public class JedisSentinelPool extends Pool<Jedis> {
if (!master.equals(currentHostMaster)) {
currentHostMaster = master;
log.info("Created JedisPool to master at " + master);
initPool(poolConfig, new JedisFactory(master.host, master.port,
initPool(poolConfig, new JedisFactory(master.getHost(), master.getPort(),
timeout, password, database));
}
}
@@ -142,7 +123,7 @@ public class JedisSentinelPool extends Pool<Jedis> {
log.fine("Connecting to Sentinel " + hap);
try {
Jedis jedis = new Jedis(hap.host, hap.port);
Jedis jedis = new Jedis(hap.getHost(), hap.getPort());
if (master == null) {
master = toHostAndPort(jedis
@@ -173,7 +154,7 @@ public class JedisSentinelPool extends Pool<Jedis> {
final HostAndPort hap = toHostAndPort(Arrays.asList(sentinel
.split(":")));
MasterListener masterListener = new MasterListener(masterName,
hap.host, hap.port);
hap.getHost(), hap.getPort());
masterListeners.add(masterListener);
masterListener.start();
}
@@ -182,10 +163,10 @@ public class JedisSentinelPool extends Pool<Jedis> {
}
private HostAndPort toHostAndPort(List<String> getMasterAddrByNameResult) {
final HostAndPort hap = new HostAndPort();
hap.host = getMasterAddrByNameResult.get(0);
hap.port = Integer.parseInt(getMasterAddrByNameResult.get(1));
return hap;
String host = getMasterAddrByNameResult.get(0);
int port = Integer.parseInt(getMasterAddrByNameResult.get(1));
return new HostAndPort(host, port);
}
protected class JedisPubSubAdapter extends JedisPubSub {