Esempio n. 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());
     }
   }
 }
Esempio n. 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();
 }
Esempio n. 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();
 }
Esempio n. 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();
 }