Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement