jdk/src/java.naming/share/classes/com/sun/jndi/ldap/pool/PoolCleaner.java
changeset 39835 4ecd563fecf6
parent 25859 3317bb8137f4
equal deleted inserted replaced
39834:53a6fb443c20 39835:4ecd563fecf6
    28 /**
    28 /**
    29  * Thread that wakes up periodically and closes expired, unused connections.
    29  * Thread that wakes up periodically and closes expired, unused connections.
    30  *
    30  *
    31  * @author Rosanna Lee
    31  * @author Rosanna Lee
    32  */
    32  */
    33 final public class PoolCleaner extends Thread {
    33 final public class PoolCleaner implements Runnable {
    34     final private Pool[] pools;
    34     final private Pool[] pools;
    35     final private long period;
    35     final private long period;
    36 
    36 
    37     /**
    37     /**
    38      * @param period ms to wait between cleaning
    38      * @param period ms to wait between cleaning
    40      */
    40      */
    41     public PoolCleaner(long period, Pool[] pools) {
    41     public PoolCleaner(long period, Pool[] pools) {
    42         super();
    42         super();
    43         this.period = period;
    43         this.period = period;
    44         this.pools = pools.clone();
    44         this.pools = pools.clone();
    45         setDaemon(true);
       
    46     }
    45     }
    47 
    46 
       
    47     @Override
    48     public void run() {
    48     public void run() {
    49         long threshold;
    49         long threshold;
    50         while (true) {
    50         while (true) {
    51             synchronized (this) {
    51             synchronized (this) {
    52                 // Wait for duration of period ms
    52                 // Wait for duration of period ms