You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/06/23 20:16:10 UTC

[Bug 54537] StatementFinalizer closeInvoked is too slow for large batch jobs.

https://bz.apache.org/bugzilla/show_bug.cgi?id=54537

--- Comment #3 from Rahul Singh <rm...@csc.com> ---
Can't we get keep ArrayList as it and instead of removing the object from the
list (first line of StatementFinalizer.closeInvoked() method), just get that
Statement reference and close that.

At the end of loop when all Statements have been closed, we can just call
clear() on the list. It will nullify all the references and those will GCed
latter.

Finding a particular entry in a linked list having millions of objects may also
have some cost.

With this code method closeInvoked() should look like
public void closeInvoked()
  {
    for (WeakReference ws : this.statements) {
      Statement st = (Statement)ws.get();
      if (st == null) continue;
      try {
        st.close();
      } catch (Exception ignore) {
        if (log.isDebugEnabled())
          log.debug("Unable to closed statement upon connection close.",
ignore);
      }
    }
   this.statements.clear();
  }

Hope I am correct!!!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org