Methods Summary |
---|
private void | internalRegisterPool(InternalManagedConnectionPool mcp, long interval)
log.debug("internalRegisterPool: registering pool with interval " + interval + " old interval: " + this.interval);
synchronized (pools)
{
pools.add(mcp);
if (interval > 1 && interval/2 < this.interval)
{
this.interval = interval/2;
long maybeNext = System.currentTimeMillis() + this.interval;
if (next > maybeNext && maybeNext > 0)
{
next = maybeNext;
log.debug("internalRegisterPool: about to notify thread: old next: " + next + ", new next: " + maybeNext);
pools.notify();
}
}
}
|
private void | internalUnregisterPool(InternalManagedConnectionPool mcp)
synchronized (pools)
{
pools.remove(mcp);
if (pools.size() == 0)
{
log.debug("internalUnregisterPool: setting interval to Long.MAX_VALUE");
interval = Long.MAX_VALUE;
}
}
|
public static void | registerPool(InternalManagedConnectionPool mcp, long interval)
remover.internalRegisterPool(mcp, interval);
|
private void | setupContextClassLoader()Change the context classloader to be where the idle remover was loaded from.
This avoids holding a reference to the caller's classloader which may be undeployed.
// Could be null if loaded from system classloader
final ClassLoader cl = IdleRemover.class.getClassLoader();
if (cl == null)
return;
SecurityManager sm = System.getSecurityManager();
if (sm == null)
Thread.currentThread().setContextClassLoader(cl);
AccessController.doPrivileged(new PrivilegedAction()
{
public Object run()
{
Thread.currentThread().setContextClassLoader(cl);
return null;
}
});
|
public static void | unregisterPool(InternalManagedConnectionPool mcp)
remover.internalUnregisterPool(mcp);
|
public static void | waitForBackgroundThread()For testing
synchronized (remover.pools)
{
return;
}
|