Only register a DataSource with JMX if it is a singleton
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 31 Mar 2011 13:22:11 +0000 (13:22 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 31 Mar 2011 13:22:11 +0000 (13:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1087292 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/NamingContextListener.java
webapps/docs/changelog.xml
webapps/docs/config/context.xml

index ef9777b..3f3660e 100644 (file)
@@ -1014,7 +1014,8 @@ public class NamingContextListener
             logger.error(sm.getString("naming.bindFailed", e));
         }
 
-        if ("javax.sql.DataSource".equals(ref.getClassName())) {
+        if ("javax.sql.DataSource".equals(ref.getClassName()) &&
+                resource.getSingleton()) {
             try {
                 ObjectName on = createObjectName(resource);
                 Object actualResource = envCtx.lookup(resource.getName());
index 65930df..8e35a75 100644 (file)
         Don&apos;t append the jvmRoute to a session ID if the jvmRoute is a zero
         length string. (markt) 
       </fix>
+      <fix>
+        Don&apos;t register non-singelton DataSource resources with JMX. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">
index d998588..abc7276 100644 (file)
         attribute is <code>true</code>, multiple JNDI lookups for this resource
         will return the same object. If this attribute is <code>false</code>,
         multiple JNDI lookups for this resource will return different objects.
-        The value of this attribute must be <code>true</code> or
-        <code>false</code>. By default, this attribute is <code>true</code>.</p>
+        This attribute must be <code>true</code> for
+        <code>javax.sql.DataSource</code> resources to enable JMX registration
+        of the DataSource. The value of this attribute must be <code>true</code>
+        or <code>false</code>. By default, this attribute is <code>true</code>.
+        </p>
       </attribute>
 
       <attribute name="type" required="true">