geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: rev 53824 - geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/work
Date Tue, 05 Oct 2004 20:32:36 GMT
Author: ammulder
Date: Tue Oct  5 13:32:35 2004
New Revision: 53824

Modified:
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java
Log:
Better logging for connector Work failures if the connector
  didn't provide a WorkListener (GERONIMO-363)


Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/work/WorkerContext.java
Tue Oct  5 13:32:35 2004
@@ -39,12 +39,22 @@
  */
 public class WorkerContext implements Work {
 
-    private Log log = LogFactory.getLog(WorkerContext.class);
+    private static final Log log = LogFactory.getLog(WorkerContext.class);
 
     /**
      * Null WorkListener used as the default WorkListener.
      */
-    private static final WorkListener NULL_WORK_LISTENER = new WorkAdapter();
+    private static final WorkListener NULL_WORK_LISTENER = new WorkAdapter() {
+        public void workRejected(WorkEvent event) {
+            if(event.getException() != null) {
+                if(event.getException() instanceof WorkCompletedException && event.getException().getCause()
!= null) {
+                    log.error(event.getWork().toString(), event.getException().getCause());
+                } else {
+                    log.error(event.getWork().toString(), event.getException());
+                }
+            }
+        }
+    };
 
     /**
      * Priority of the thread, which will execute this work.

Mime
View raw message