1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
public
class
ShardedSentinelTest {
public
static
void
main(String[] args) {
GenericObjectPoolConfig config =
new
GenericObjectPoolConfig();
List<String> masters =
new
ArrayList<String>();
masters.add(
"mymaster"
);
Set<String> sentinels =
new
HashSet<String>();
sentinels.add(
"xxxxxx:29111"
);
ShardedJedisSentinelPool pool =
new
ShardedJedisSentinelPool(masters, sentinels, config,
60000
);
ShardedJedis jedis = pool.getResource();
for
(
int
i =
1
; i <
10000
; i++) {
String val = jedis.set(
"ss"
+ i,
"vv"
+ i);
System.out.println(jedis.get(
"ss"
+ i));
}
jedis.close();
pool.destroy();
}
}
|