|
Folks: Has anyone worked with connection pools in JT400? I'm using the AS400ConnectionPool and JDBCConnectionPool for my application ... so far I haven't had any problems with them, but I just noticed something the other day. The AS400ConnectionPoolMaintenanceThread never seems to end. And when a new connection pool is created, so is a new maintenance thread. >From what I can see, the run method, in the com.ibm.as400.access.PoolMaintenance object, does not have any ability to exit and shutdown. --------- public synchronized void run() { if (Trace.traceOn_) { Trace.log(Trace.INFORMATION, "Connection pool maintenance daemon is started..."); } run_ = true; while (true) { if (run_) { try { // sleep for cleanup interval. wait(pool_.getCleanupInterval()); } catch (InterruptedException ie) { Trace.log(Trace.ERROR, "Connection pool maintenance daemon failed."); } pool_.cleanupConnections(); lastRun_ = System.currentTimeMillis(); // set the time of last run. } else { try { wait(); } catch (InterruptedException e) { Trace.log(Trace.ERROR, "Connection pool maintenance daemon failed."); } } } } /** * Sets whether the maintenance thread is running. * @param running true if running; false otherwise. **/ public synchronized void setRunning(boolean running) { if (run_ != running) { run_ = running; notify(); } } --------- As you can see from the above, the entire loop is unconditional and never breaks out. Is this a bug, or am I just not understanding threads well enough (which I freely admit to not being an expert in). Thanks! david
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.