You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2012/11/30 10:48:14 UTC

svn commit: r1415561 - /servicemix/components/trunk/shared-libraries/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java

Author: ffang
Date: Fri Nov 30 09:48:13 2012
New Revision: 1415561

URL: http://svn.apache.org/viewvc?rev=1415561&view=rev
Log:
[SMXCOMP-956]use one thread directly rather than the threadpool as this method actually get invoked only once

Modified:
    servicemix/components/trunk/shared-libraries/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java

Modified: servicemix/components/trunk/shared-libraries/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/shared-libraries/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java?rev=1415561&r1=1415560&r2=1415561&view=diff
==============================================================================
--- servicemix/components/trunk/shared-libraries/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java (original)
+++ servicemix/components/trunk/shared-libraries/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java Fri Nov 30 09:48:13 2012
@@ -320,12 +320,12 @@ public class AsyncBaseLifeCycle implemen
 
         if (doPoll) {
             synchronized (this.polling) {
-                consumerExecutor.execute(new Runnable() {
+                new Thread() {
                     public void run() {
                         poller = Thread.currentThread();
                         pollDeliveryChannel();
                     }
-                });
+                }.start();
                 polling.wait();
             }
         }
@@ -385,13 +385,15 @@ public class AsyncBaseLifeCycle implemen
                         }
                     }
                     if (oldStatus == ExchangeStatus.ACTIVE) {
-                            newExchange.setStatus(ExchangeStatus.ERROR);
-                            if (t instanceof RejectedExecutionException) {
-                                if (t.getMessage() == null || t.getMessage().length() == 0) {
-                                    t = new RuntimeException("Task rejected from java.util.concurrent.ThreadPoolExecutor, need bigger ThreadPool", t);
-                                }
+                        newExchange.setStatus(ExchangeStatus.ERROR);
+                        if (t instanceof RejectedExecutionException) {
+                            if (t.getMessage() == null || t.getMessage().length() == 0) {
+                                t = new RuntimeException(
+                                                         "Task rejected from java.util.concurrent.ThreadPoolExecutor, need bigger ThreadPool",
+                                                         t);
                             }
-                            newExchange.setError(t instanceof Exception ? (Exception) t : new Exception(t));
+                        }
+                        newExchange.setError(t instanceof Exception ? (Exception)t : new Exception(t));
                         channel.send(newExchange);
                     }
                 } catch (Exception inner) {