DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38596>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38596

           Summary: Unnecessary synchronization and garbage in
                    DataSourceRealm
           Product: Tomcat 5
           Version: Nightly Build
          Platform: Other
               URL: http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x
                    /catalina/src/share/org/apache/catalina/realm/DataSource
                    Realm.java
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P4
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


DataSourceRealm.java declares two StringBuffers fields, preparedRoles and
preparedCredentials, that hold the SQL to be used. After these fields are
assigned they do not change but to use them StringBuffer.toString() must be
called. The toString method is synchronized and creates a new String instance
each time it's called.

The simple fix is to change those fields to Strings and update the start()
method, and remove the toString() calls in credentials(...) and roles(...) 
methods.

A better, more intrusive, fix is to take advantage of PreparedStatements like
JDBCRealm does.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to