示例#1
0
 @Override
 public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis) {
   boolean wasEnabled = getPoolProperties().isPoolSweeperEnabled();
   getPoolProperties().setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
   boolean shouldBeEnabled = getPoolProperties().isPoolSweeperEnabled();
   // make sure pool cleaner starts/stops when it should
   if (!wasEnabled && shouldBeEnabled) {
     pool.initializePoolCleaner(getPoolProperties());
   } else if (wasEnabled) {
     pool.terminatePoolCleaner();
     if (shouldBeEnabled) {
       pool.initializePoolCleaner(getPoolProperties());
     }
   }
 }
示例#2
0
 @Override
 public void setRemoveAbandonedTimeout(int removeAbandonedTimeout) {
   boolean wasEnabled = getPoolProperties().isPoolSweeperEnabled();
   getPoolProperties().setRemoveAbandonedTimeout(removeAbandonedTimeout);
   boolean shouldBeEnabled = getPoolProperties().isPoolSweeperEnabled();
   // make sure pool cleaner starts/stops when it should
   if (!wasEnabled && shouldBeEnabled) pool.initializePoolCleaner(getPoolProperties());
   else if (wasEnabled && !shouldBeEnabled) pool.terminatePoolCleaner();
 }
示例#3
0
 @Override
 public void setTestWhileIdle(boolean testWhileIdle) {
   boolean wasEnabled = getPoolProperties().isPoolSweeperEnabled();
   getPoolProperties().setTestWhileIdle(testWhileIdle);
   boolean shouldBeEnabled = getPoolProperties().isPoolSweeperEnabled();
   // make sure pool cleaner starts/stops when it should
   if (!wasEnabled && shouldBeEnabled) pool.initializePoolCleaner(getPoolProperties());
   else if (wasEnabled && !shouldBeEnabled) pool.terminatePoolCleaner();
 }
示例#4
0
 @Override
 public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis) {
   boolean wasEnabled = getPoolProperties().isPoolSweeperEnabled();
   getPoolProperties().setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
   boolean shouldBeEnabled = getPoolProperties().isPoolSweeperEnabled();
   // make sure pool cleaner starts/stops when it should
   if (!wasEnabled && shouldBeEnabled) pool.initializePoolCleaner(getPoolProperties());
   else if (wasEnabled && !shouldBeEnabled) pool.terminatePoolCleaner();
 }