Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[SMXCOMP-956]use one thread directly rather than the threadpool as th…

…is method actually get invoked only once

git-svn-id: https://svn.apache.org/repos/asf/servicemix/components/trunk@1415561 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 82a1db9fff91f1c3251eb40db29fe9a29a1c180a 1 parent 0b57b76
Freeman(Yue) Fang authored November 30, 2012
18  shared-libraries/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
@@ -320,12 +320,12 @@ protected void doStart() throws Exception {
320 320
 
321 321
         if (doPoll) {
322 322
             synchronized (this.polling) {
323  
-                consumerExecutor.execute(new Runnable() {
  323
+                new Thread() {
324 324
                     public void run() {
325 325
                         poller = Thread.currentThread();
326 326
                         pollDeliveryChannel();
327 327
                     }
328  
-                });
  328
+                }.start();
329 329
                 polling.wait();
330 330
             }
331 331
         }
@@ -385,13 +385,15 @@ public void run() {
385 385
                         }
386 386
                     }
387 387
                     if (oldStatus == ExchangeStatus.ACTIVE) {
388  
-                            newExchange.setStatus(ExchangeStatus.ERROR);
389  
-                            if (t instanceof RejectedExecutionException) {
390  
-                                if (t.getMessage() == null || t.getMessage().length() == 0) {
391  
-                                    t = new RuntimeException("Task rejected from java.util.concurrent.ThreadPoolExecutor, need bigger ThreadPool", t);
392  
-                                }
  388
+                        newExchange.setStatus(ExchangeStatus.ERROR);
  389
+                        if (t instanceof RejectedExecutionException) {
  390
+                            if (t.getMessage() == null || t.getMessage().length() == 0) {
  391
+                                t = new RuntimeException(
  392
+                                                         "Task rejected from java.util.concurrent.ThreadPoolExecutor, need bigger ThreadPool",
  393
+                                                         t);
393 394
                             }
394  
-                            newExchange.setError(t instanceof Exception ? (Exception) t : new Exception(t));
  395
+                        }
  396
+                        newExchange.setError(t instanceof Exception ? (Exception)t : new Exception(t));
395 397
                         channel.send(newExchange);
396 398
                     }
397 399
                 } catch (Exception inner) {

0 notes on commit 82a1db9

Please sign in to comment.
Something went wrong with that request. Please try again.