You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/12/17 05:13:47 UTC
svn commit: r727272 -
/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
Author: fhanik
Date: Tue Dec 16 20:13:45 2008
New Revision: 727272
URL: http://svn.apache.org/viewvc?rev=727272&view=rev
Log:
Catch any exceptions since we don't handle them later in the chain
Modified:
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java?rev=727272&r1=727271&r2=727272&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java Tue Dec 16 20:13:45 2008
@@ -25,9 +25,14 @@
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 @@
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;
+ }
+
}
//=================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org