Ejemplo 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());
     }
   }
 }
Ejemplo 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();
 }
Ejemplo 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();
 }
Ejemplo 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();
 }