Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // variables
- private static Object staticLock = new Object();
- private static JedisPool pool;
- // methods
- private void setupRedis() {
- JedisPoolConfig jd = new JedisPoolConfig();
- jd.setMaxWaitMillis(1000L);
- jd.setMinIdle(5);
- jd.setTestOnBorrow(true);
- jd.setMaxTotal(100);
- jd.setBlockWhenExhausted(true);
- this.jpc = jd;
- }
- public JedisPool getPool() {
- if (pool == null) {
- synchronized(staticLock) {
- if (pool == null) {
- pool = new JedisPool(this.jpc,this.address,this.port);
- }
- }
- }
- return pool;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement