[opencms-dev] Reolads and too many connections problem
Oliver Faulhaber
ofh3 at hotmail.com
Mon Mar 24 22:22:34 CET 2003
severeal messages ago, there has been talked about too many connections and
about restarting Tomcat (to update classes).
We use the Tomcat ManagerServlet to start, stop and reload OpenCms. After a
certain amount of reloads, there are too many connections existing in the
MySql server.
We stepped through the code and encountered following: While stopping the
OpenCms application, the DB connections are destroyed correctly. Everything
seems cleared, but the CmsCronScheduler has not been stopped. It normaly
wakes up every minute + 10 seconds. When OpenCms is stopped, then the
CmsCronScheduler throws the Exception below and terminates.
WebappClassLoader: Lifecycle error : CL stopped
java.lang.NoClassDefFoundError: com/opencms/core/CmsCronScheduleJobStarter
at com.opencms.core.CmsCronScheduler.run(CmsCronScheduler.java:90)
The problem is, that before the Scheduler terminates, it will restore the
connection pool, which will exist until the Tomcat server shuts down. This
is the reason, why the DB-Server (MySql) hangs up after a certain number of
OpenCms-reloads.
Hence, explicit destroying the Scheduler helps. We have implemented the
solution here, but we would be very glad, if the changes would be part in
the next release. We can't find a bug tracking system like Bugzilla, thus we
will report the changes here:
Changes in class CmsCronScheduler:
add a new Member variable: private boolean m_destroyed = false;
in method run(), change the loop criteria from for(;;) into
while(!m_destroyed) { // ever
and after the catch block insert:
if( m_destroyed)
break;
(Before the Scheduler can do its work) Further, add the destroy Method:
public void destroy()
{
m_destroyed = true;
}
Changes in class OpenCms, method destroy(): insert a new line (we have
inserted it as the first line):
m_scheduler.destroy();
Thats it. Applying this changes, we can reload OpenCms as often we need.
Regards,
Oliver
_________________________________________________________________
Messenger - Wer in Echtzeit kommunizieren will, lädt den MSN Messenger.
Cool, kostenlos und mit 3D Emoticons: http://messenger.msn.de
More information about the opencms-dev
mailing list