分布式连接池调用是怎么选择DB的?看下面代码中都没发现是怎么选库的,如果是选择的默认,那么哪里可以指定一个DB?
public void test8shardPipelinedPool() {
ShardedJedis>
ShardedJedisPipeline pipeline = one.pipelined();
long start = System.currentTimeMillis();
for (int i = 0; i < 100000; i++) {
pipeline.set("sppn" + i, "n" + i);
}
List<Object> results = pipeline.syncAndReturnAll();
long end = System.currentTimeMillis();
pool.returnResource(one);
System.out.println("Pipelined@Pool SET: " + ((end - start) / 1000.0)
+ " seconds");
}
Collection<Jedis> collection=shardedJedis.getAllShards();
Iterator<Jedis> jedis = collection.iterator();
while(jedis.hasNext()){
jedis.next().select(redisIndex);
}
ShardedJedisPipeline pipeline = shardedJedis.pipelined();
if (fields.length > 0) {
for (int i = 0; i < fields.length; i++) {
pipeline.hset(key,fields[i],values[i]);
}
pipeline.sync();
}