Skip to content

Commit

Permalink
Move getResource under exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Sackmann committed Nov 14, 2017
1 parent d237878 commit 89136d1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.number
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Fri Oct 27 15:54:33 CEST 2017
build.number=17
#Thu Nov 09 12:39:54 CET 2017
build.number=28
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,31 @@ public static JedisPool init(String cacheName, Struct arguments){

Integer port = caster.toInteger(hosts.split(":")[1]);

JedisPoolConfig config = new JedisPoolConfig();
config.setTestOnBorrow(true);
// config.setTestOnReturn(true);

instance.put(cacheName, new JedisPool(config, host, port));
Integer setMaxTotal = caster.toInteger(arguments.get("setMaxTotal"),128);
Integer setMaxIdle = caster.toInteger(arguments.get("namespace"),128);
Integer setMinIdle = caster.toInteger(arguments.get("namespace"),16);
Integer setMinEvictableIdleTimeMillis = caster.toInteger(arguments.get("setMinEvictableIdleTimeMillis"),60000);
Integer setTimeBetweenEvictionRunsMillis = caster.toInteger(arguments.get("setTimeBetweenEvictionRunsMillis"),30000);
Integer setNumTestsPerEvictionRun = caster.toInteger(arguments.get("setNumTestsPerEvictionRun"),3);

Boolean setTestOnBorrow = caster.toBoolean(arguments.get("setTestOnBorrow"),true);
Boolean setTestOnReturn = caster.toBoolean(arguments.get("setTestOnReturn"),true);
Boolean setTestWhileIdle = caster.toBoolean(arguments.get("setTestWhileIdle"),true);
Boolean setBlockWhenExhausted = caster.toBoolean(arguments.get("setBlockWhenExhausted"),true);

final JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(setMaxTotal);
poolConfig.setMaxIdle(setMaxIdle);
poolConfig.setMinIdle(setMinIdle);
poolConfig.setTestOnBorrow(setTestOnBorrow);
poolConfig.setTestOnReturn(setTestOnReturn);
poolConfig.setTestWhileIdle(setTestWhileIdle);
poolConfig.setMinEvictableIdleTimeMillis(setMinEvictableIdleTimeMillis);
poolConfig.setTimeBetweenEvictionRunsMillis(setTimeBetweenEvictionRunsMillis);
poolConfig.setNumTestsPerEvictionRun(setNumTestsPerEvictionRun);
poolConfig.setBlockWhenExhausted(setBlockWhenExhausted);

instance.put(cacheName, new JedisPool(poolConfig, host, port));

} catch (PageException e) {
e.printStackTrace();
Expand Down

0 comments on commit 89136d1

Please sign in to comment.