Now Sharded will handle connections instead of Info, so connection won't be shared between instances of ShardedJedis

This commit is contained in:
Jonathan Leibiusky
2010-11-22 12:49:18 -03:00
parent ad149e8252
commit a1815f3881
7 changed files with 58 additions and 47 deletions

View File

@@ -103,4 +103,18 @@ public class ShardedJedisPoolTest extends Assert {
ShardedJedis newJedis = pool.getResource();
newJedis.incr("foo");
}
@Test
public void shouldNotShareInstances() throws Exception {
Config config = new Config();
config.maxActive = 2;
config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_FAIL;
ShardedJedisPool pool = new ShardedJedisPool(config, shards);
ShardedJedis j1 = pool.getResource();
ShardedJedis j2 = pool.getResource();
assertNotSame(j1.getShard("foo"), j2.getShard("foo"));
}
}