# Class ConnectionPool.PoolCleaner

java.lang.Object
java.util.TimerTask
org.apache.tomcat.jdbc.pool.ConnectionPool.PoolCleaner

All Implemented Interfaces:
  `Runnable`

Enclosing class:
  `ConnectionPool`

protected static class ConnectionPool.PoolCleaner extends TimerTask
A scheduled task that periodically checks for abandoned connections, validates idle connections, and resizes the idle pool according to the pool's configuration.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected WeakReference<ConnectionPool>`
`pool`
Weak reference to the connection pool being monitored.
`protected long`
`sleepTime`
Sleep interval in milliseconds between cleaner runs.

## Method Summary

Modifier and Type
Method
Description
`void`
`run()`
`void`
`start()`
Starts the pool cleaner by registering it with the shared timer.
`void`
`stopRunning()`
Stops the pool cleaner by unregistering it from the shared timer.

### Methods inherited from class TimerTask

`cancel, scheduledExecutionTime`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### pool

protected WeakReference<ConnectionPool> pool
Weak reference to the connection pool being monitored.

### sleepTime

protected long sleepTime
Sleep interval in milliseconds between cleaner runs.

## Method Details

### run

public void run()

Specified by:
  `run` in interface `Runnable`
Specified by:
  `run` in class `TimerTask`

### start

public void start()
Starts the pool cleaner by registering it with the shared timer.

### stopRunning

public void stopRunning()
Stops the pool cleaner by unregistering it from the shared timer.