}
size.set(0);
if (this.getPoolProperties().isJmxEnabled()) stopJmx();
-
+ PoolProperties.InterceptorDefinition[] proxies = getPoolProperties().getJdbcInterceptorsAsArray();
+ for (int i=0; i<proxies.length; i++) {
+ try {
+ proxies[i].getInterceptorClass().newInstance().poolClosed(this);
+ }catch (Exception x) {
+ log.debug("Unable to inform interceptor of pool closure.",x);
+ }
+ }
} //closePool
public void setUseEquals(boolean useEquals) {
this.useEquals = useEquals;
}
+
+ /**
+ * This method is invoked by a connection pool when the pool is closed.
+ * Interceptor classes can override this method if they keep static
+ * variables or other tracking means around.
+ * <b>This method is only invoked on a single instance of the interceptor, and not on every instance created.</b>
+ * @param pool - the pool that is being closed.
+ */
+ public void poolClosed(ConnectionPool pool) {
+ }
}
public Class<? extends JdbcInterceptor> getInterceptorClass() throws ClassNotFoundException {
if (clazz==null) {
- clazz = Class.forName(getClassName(), true, JdbcInterceptor.class.getClassLoader());
+ clazz = Class.forName(getClassName(), true, this.getClass().getClassLoader());
}
- return clazz;
+ return (Class<? extends JdbcInterceptor>)clazz;
}
}
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void poolClosed(ConnectionPool pool) {
+ perPoolStats.remove(pool.getName());
+ super.poolClosed(pool);
+ }
+
public CompositeData[] getSlowQueriesCD() {
return null;
}