camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1384319 - in /camel/branches/camel-2.9.x: ./ components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java
Date Thu, 13 Sep 2012 13:19:49 GMT
Author: davsclaus
Date: Thu Sep 13 13:19:48 2012
New Revision: 1384319

URL: http://svn.apache.org/viewvc?rev=1384319&view=rev
Log:
CAMEL-5607: Use API from Camel for thread pool lifecycle.

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1384316
  Merged /camel/branches/camel-2.10.x:r1384318

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java?rev=1384319&r1=1384318&r2=1384319&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java
Thu Sep 13 13:19:48 2012
@@ -18,7 +18,6 @@ package org.apache.camel.component.paxlo
 
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -70,14 +69,16 @@ public class PaxLoggingConsumer extends 
         // TODO: populate exchange headers
         exchange.getIn().setBody(paxLoggingEvent);
 
-        LOG.trace("PaxLogging {} is firing", endpoint.getName());
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("PaxLogging {} is firing", endpoint.getName());
+        }
         try {
             getProcessor().process(exchange);
-            // log exception if an exception occurred and was not handled
-            if (exchange.getException() != null) {
-                getExceptionHandler().handleException("Error processing exchange", exchange,
exchange.getException());
-            }
         } catch (Exception e) {
+            exchange.setException(e);
+        }
+        // log exception if an exception occurred and was not handled
+        if (exchange.getException() != null) {
             getExceptionHandler().handleException("Error processing exchange", exchange,
exchange.getException());
         }
     }
@@ -88,7 +89,7 @@ public class PaxLoggingConsumer extends 
         Properties props = new Properties();
         props.put("org.ops4j.pax.logging.appender.name", endpoint.getName());
         registration = endpoint.getComponent().getBundleContext().registerService(PaxAppender.class.getName(),
this, props);
-        executor = Executors.newSingleThreadExecutor();
+        executor = endpoint.getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this,
"PaxLoggingEventTask");
     }
 
     @Override
@@ -96,7 +97,10 @@ public class PaxLoggingConsumer extends 
         if (registration != null) {
             registration.unregister();
         }
-        executor.shutdown();
+        if (executor != null) {
+            endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
+            executor = null;
+        }
         super.doStop();
     }
 }



Mime
View raw message