From: markt
Date: Thu, 31 Mar 2011 13:22:11 +0000 (+0000)
Subject: Only register a DataSource with JMX if it is a singleton
X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4256ae18ab08f4a36a99fd2c34329fe2b93270af;p=tomcat7.0
Only register a DataSource with JMX if it is a singleton
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1087292 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/java/org/apache/catalina/core/NamingContextListener.java b/java/org/apache/catalina/core/NamingContextListener.java
index ef9777b31..3f3660e61 100644
--- a/java/org/apache/catalina/core/NamingContextListener.java
+++ b/java/org/apache/catalina/core/NamingContextListener.java
@@ -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());
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 65930df45..8e35a7593 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -134,6 +134,9 @@
Don't append the jvmRoute to a session ID if the jvmRoute is a zero
length string. (markt)
+
+ Don't register non-singelton DataSource resources with JMX. (markt)
+
diff --git a/webapps/docs/config/context.xml b/webapps/docs/config/context.xml
index d99858875..abc727621 100644
--- a/webapps/docs/config/context.xml
+++ b/webapps/docs/config/context.xml
@@ -1044,8 +1044,11 @@
attribute is true, multiple JNDI lookups for this resource
will return the same object. If this attribute is false,
multiple JNDI lookups for this resource will return different objects.
- The value of this attribute must be true or
- false. By default, this attribute is true.
+ This attribute must be true for
+ javax.sql.DataSource resources to enable JMX registration
+ of the DataSource. The value of this attribute must be true
+ or false. By default, this attribute is true.
+