Hi folks,

after some serious profiling (and finding a bug in the Mustang b68
VM), I've added some additional cleanup calls to OJB (SVN of the
stable branch). Please give it a try to see whether that suffices.
However, you also need to do some work in your own webapp to ensure
proper cleanup. The standard way is to use a servlet context listener
like this (based upon Rick's test webapp):

public class CleanupListener implements ServletContextListener
{
  public void contextInitialized(ServletContextEvent event)
  { }

  public void contextDestroyed(ServletContextEvent event)
  {
    PersistenceBrokerFactory.shutdown();
    LogFactory.releaseAll();

    for (Enumeration e = DriverManager.getDrivers(); e.hasMoreElements();)
    {
      Driver driver = (Driver)e.nextElement();

      if (driver.getClass().getClassLoader() == getClass().getClassLoader())
      {
        try
        {
          DriverManager.deregisterDriver(driver);
        }
        catch (SQLException ex)
        {
            ex.printStackTrace();
        }
      }
    }
  }
}


What this does is basically performing OJB cleanup, commons-logging
cleanup, and cleanup of all JDBC drivers loaded in the webapp (which
is for instance necessary for the MySql driver).

For more info see also here:

http://opensource2.atlassian.com/confluence/spring/pages/viewpage.action?pageId=2669

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to