1 22 package org.enhydra.jdbc.pool; 23 24 28 public class PoolKeeper implements Runnable { 29 30 private long sleepTime; private GenericPool pool; private boolean running = true; 33 34 37 public PoolKeeper(long sleepTime, GenericPool pool) { 38 this.sleepTime = sleepTime; 39 this.pool = pool; 40 } 41 42 public void stop() { 43 synchronized (this ) { 44 running = false; 45 } 46 } 47 48 51 public void run() { 52 while (running && !Thread.interrupted()) { 53 try { 54 synchronized (this) { 55 wait(this.sleepTime); } 57 } catch (InterruptedException e) { 58 break; 59 } 60 this.pool.cleanUp(); } 62 this.pool = null; 64 } 65 66 } | Popular Tags |