From: fhanik Date: Fri, 10 Jul 2009 17:16:25 +0000 (+0000) Subject: remove dbcp X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=e4b827b1f67fcd360f5c721c2c156432c87ddcac;p=tomcat7.0 remove dbcp add classpath to javadoc start documenting DataSource git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@793042 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/jdbc-pool/build.xml b/modules/jdbc-pool/build.xml index 19f3a4c8e..574f2e832 100644 --- a/modules/jdbc-pool/build.xml +++ b/modules/jdbc-pool/build.xml @@ -86,7 +86,9 @@ - + + + diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSource.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSource.java index aa98c74b8..03637ad59 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSource.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/DataSource.java @@ -50,17 +50,34 @@ public class DataSource extends DataSourceProxy implements MBeanRegistration,jav // Register the actual pool itself under the tomcat.jdbc domain //=============================================================================== protected volatile ObjectName oname = null; + + /** + * Unregisters the underlying connection pool mbean.
+ * {@inheritDoc} + */ public void postDeregister() { if (oname!=null) unregisterJmx(); } + /** + * no-op
+ * {@inheritDoc} + */ public void postRegister(Boolean registrationDone) { } + /** + * no-op
+ * {@inheritDoc} + */ public void preDeregister() throws Exception { } + /** + * If the connection pool MBean exists, it will be registered during this operation.
+ * {@inheritDoc} + */ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { try { this.oname = createObjectName(name); @@ -71,6 +88,12 @@ public class DataSource extends DataSourceProxy implements MBeanRegistration,jav return name; } + /** + * Creates the ObjectName for the ConnectionPoolMBean object to be registered + * @param original the ObjectName for the DataSource + * @return the ObjectName for the ConnectionPoolMBean + * @throws MalformedObjectNameException + */ public ObjectName createObjectName(ObjectName original) throws MalformedObjectNameException { String domain = "tomcat.jdbc"; Hashtable properties = original.getKeyPropertyList(); @@ -84,10 +107,15 @@ public class DataSource extends DataSourceProxy implements MBeanRegistration,jav return name; } + /** + * Registers the ConnectionPoolMBean + */ protected void registerJmx() { try { - MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); - mbs.registerMBean(pool.getJmxPool(), oname); + if (pool.getJmxPool()!=null) { + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + mbs.registerMBean(pool.getJmxPool(), oname); + } } catch (Exception e) { log.error("Unable to register JDBC pool with JMX",e); }