SHARE
TWEET

Untitled

a guest Jul 21st, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // variables
  2.     private static Object staticLock = new Object();
  3.     private static JedisPool pool;
  4.    
  5. // methods
  6. private void setupRedis() {
  7.         JedisPoolConfig jd = new JedisPoolConfig();
  8.         jd.setMaxWaitMillis(1000L);
  9.         jd.setMinIdle(5);
  10.         jd.setTestOnBorrow(true);
  11.         jd.setMaxTotal(100);
  12.         jd.setBlockWhenExhausted(true);
  13.         this.jpc = jd;
  14.     }
  15.     public JedisPool getPool() {
  16.         if (pool == null) {
  17.             synchronized(staticLock) {
  18.                 if (pool == null) {
  19.                     pool = new JedisPool(this.jpc,this.address,this.port);
  20.                 }
  21.             }
  22.         }
  23.         return pool;
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top