You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2009/05/04 23:31:18 UTC

svn commit: r771453 - in /webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads: NativeWorkerPool.java WorkerPool.java

Author: veithen
Date: Mon May  4 21:31:18 2009
New Revision: 771453

URL: http://svn.apache.org/viewvc?rev=771453&view=rev
Log:
Log uncaught exceptions in WorkerPool#execute. This makes it easier to debug issues like SYNAPSE-541.

Modified:
    webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/NativeWorkerPool.java
    webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/WorkerPool.java

Modified: webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/NativeWorkerPool.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/NativeWorkerPool.java?rev=771453&r1=771452&r2=771453&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/NativeWorkerPool.java (original)
+++ webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/NativeWorkerPool.java Mon May  4 21:31:18 2009
@@ -30,7 +30,7 @@
  */
 public class NativeWorkerPool implements WorkerPool {
 
-    private static final Log log = LogFactory.getLog(NativeWorkerPool.class);
+    static final Log log = LogFactory.getLog(NativeWorkerPool.class);
 
     private final ThreadPoolExecutor executor;
     private final LinkedBlockingQueue<Runnable> blockingQueue;
@@ -56,8 +56,8 @@
             public void run() {
                 try {
                     task.run();
-                } catch (Exception ignore) {
-                    // this is to re-use this thread, even if it threw a RuntimeException
+                } catch (Throwable t) {
+                    log.error("Uncaught exception", t);
                 }
             }
         });

Modified: webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/WorkerPool.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/WorkerPool.java?rev=771453&r1=771452&r2=771453&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/WorkerPool.java (original)
+++ webservices/commons/trunk/modules/transport/modules/base/src/main/java/org/apache/axis2/transport/base/threads/WorkerPool.java Mon May  4 21:31:18 2009
@@ -20,7 +20,16 @@
 package org.apache.axis2.transport.base.threads;
 
 public interface WorkerPool {
+    /**
+     * Asynchronously execute the given task using one of the threads of the worker pool.
+     * The task is expected to terminate gracefully, i.e. {@link Runnable#run()} should not
+     * throw an exception. Any uncaught exceptions should be logged by the worker pool
+     * implementation.
+     * 
+     * @param task the task to execute
+     */
     public void execute(Runnable task);
+    
     public int getActiveCount();
     public int getQueueSize();