From: fhanik Date: Wed, 17 Dec 2008 04:13:45 +0000 (+0000) Subject: Catch any exceptions since we don't handle them later in the chain X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f19e22bc07ee688c3db824db7820b33ff7bd72d5;p=tomcat7.0 Catch any exceptions since we don't handle them later in the chain git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@727272 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java index f75c9c7f1..67cfeb300 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java @@ -25,9 +25,14 @@ import javax.management.MBeanNotificationInfo; import javax.management.Notification; import javax.management.NotificationBroadcasterSupport; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; import org.apache.tomcat.jdbc.pool.JdbcInterceptor; public class ConnectionPool extends NotificationBroadcasterSupport implements ConnectionPoolMBean { + //logger + protected static Log log = LogFactory.getLog(ConnectionPool.class); + protected org.apache.tomcat.jdbc.pool.ConnectionPool pool = null; protected AtomicInteger sequence = new AtomicInteger(0); @@ -62,14 +67,29 @@ public class ConnectionPool extends NotificationBroadcasterSupport implements Co return new MBeanNotificationInfo[] {info}; } - public void notify(final String type, String message) { - Notification n = new Notification( - type, - this, - sequence.incrementAndGet(), - System.currentTimeMillis(), - message!=null?message:""); - sendNotification(n); + /** + * Return true if the notification was sent successfully, false otherwise. + * @param type + * @param message + * @return + */ + public boolean notify(final String type, String message) { + try { + Notification n = new Notification( + type, + this, + sequence.incrementAndGet(), + System.currentTimeMillis(), + message!=null?message:""); + sendNotification(n); + return true; + }catch (Exception x) { + if (log.isDebugEnabled()) { + log.debug("Notify failed. Type="+type+"; Message="+message,x); + } + return false; + } + } //=================================================================