From: markt Date: Tue, 29 Jul 2008 14:58:05 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45453 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=85c618df3a630649fce764207f15ad9503c02dfd;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45453 Add yet more synchronisation to JDBCRealm. Based on a patch provided by Santtu Hyrkk. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@680725 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/realm/JDBCRealm.java b/java/org/apache/catalina/realm/JDBCRealm.java index 1b7e1a267..1b4dc7f94 100644 --- a/java/org/apache/catalina/realm/JDBCRealm.java +++ b/java/org/apache/catalina/realm/JDBCRealm.java @@ -38,10 +38,11 @@ import org.apache.catalina.util.StringManager; * See the JDBCRealm.howto for more details on how to set up the database and * for configuration options. * -*

TODO - Support connection pooling (including message -* format objects) so that authenticate(), -* getPassword() and authenticate() do not have to be -* synchronized and would fix the ugly connection logic.

+*

For a Realm implementation that supports connection pooling and +* doesn't require synchronisation of authenticate(), +* getPassword(), roles() and +* getPrincipal() or the ugly connection logic use the +* DataSourceRealm.

* * @author Craig R. McClanahan * @author Carson McDonald @@ -591,7 +592,7 @@ public class JDBCRealm /** * Return the Principal associated with the given user name. */ - protected Principal getPrincipal(String username) { + protected synchronized Principal getPrincipal(String username) { return (new GenericPrincipal(this, username,