You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/05/21 07:43:50 UTC
[1/8] git commit: CAMEL-6219: Downgrade to commons net 3.1 to avoid
bug in 3.2. Thanks to Lu Tahmazyan for testing and discovering this.
Updated Branches:
refs/heads/master 7bcf8430f -> 440862372
CAMEL-6219: Downgrade to commons net 3.1 to avoid bug in 3.2. Thanks to Lu Tahmazyan for testing and discovering this.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/462f00e9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/462f00e9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/462f00e9
Branch: refs/heads/master
Commit: 462f00e96b70fa6e700666861e464c9c19034578
Parents: 50154f3
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 21 05:35:25 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:38 2013 +0200
----------------------------------------------------------------------
parent/pom.xml | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/462f00e9/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 29bb9ed..bf4f107 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -97,7 +97,8 @@
<commons-lang3-version>3.1</commons-lang3-version>
<commons-logging-version>1.1.2</commons-logging-version>
<commons-math-version>2.2</commons-math-version>
- <commons-net-version>3.2</commons-net-version>
+ <!-- commons-net 3.2 has a bug so keep using 3.1, see NET-492 -->
+ <commons-net-version>3.1</commons-net-version>
<commons-pool-version>1.6</commons-pool-version>
<commons-vfs2-version>2.0</commons-vfs2-version>
<concurrentlinkedhashmap.version>1.3.2</concurrentlinkedhashmap.version>
[6/8] git commit: CAMEL-6377: Optimized routing engine to reduce
stack frames in use during routing. Work in progress.
Posted by da...@apache.org.
CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9ede1339
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9ede1339
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9ede1339
Branch: refs/heads/master
Commit: 9ede13394374659a87d313951eef9bdbafd5ff5f
Parents: 7bcf843
Author: Claus Ibsen <da...@apache.org>
Authored: Mon May 20 18:06:16 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:38 2013 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/camel/Exchange.java | 4 +
.../org/apache/camel/impl/DefaultRouteContext.java | 8 +-
.../camel/processor/CamelInternalProcessor.java | 96 ++++++++++++++-
.../processor/interceptor/DefaultChannel.java | 1 +
.../apache/camel/processor/ChoiceWithEndTest.java | 2 -
.../apache/camel/processor/NavigateRouteTest.java | 2 +-
.../RandomLoadBalanceJavaDSLBuilderTest.java | 16 +--
.../ReduceStacksNeededDuringRoutingTest.java | 3 +-
.../apache/camel/processor/SplitWithEndTest.java | 2 -
9 files changed, 109 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/main/java/org/apache/camel/Exchange.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/Exchange.java b/camel-core/src/main/java/org/apache/camel/Exchange.java
index 1c2e1bc..5e8a88d 100644
--- a/camel-core/src/main/java/org/apache/camel/Exchange.java
+++ b/camel-core/src/main/java/org/apache/camel/Exchange.java
@@ -193,6 +193,10 @@ public interface Exchange {
String TRANSFER_ENCODING = "Transfer-Encoding";
String UNIT_OF_WORK_EXHAUSTED = "CamelUnitOfWorkExhausted";
+ /**
+ * @deprecated UNIT_OF_WORK_PROCESS_SYNC is not in use and will be removed in future Camel release
+ */
+ @Deprecated
String UNIT_OF_WORK_PROCESS_SYNC = "CamelUnitOfWorkProcessSync";
String XSLT_FILE_NAME = "CamelXsltFileName";
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
index 0531e6c..07c3235 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
@@ -150,10 +150,13 @@ public class DefaultRouteContext implements RouteContext {
if (!eventDrivenProcessors.isEmpty()) {
Processor target = Pipeline.newInstance(getCamelContext(), eventDrivenProcessors);
+ String routeId = route.idOrCreate(getCamelContext().getNodeIdFactory());
+
// and wrap it in a unit of work so the UoW is on the top, so the entire route will be in the same UoW
- UnitOfWorkProcessor unitOfWorkProcessor = new UnitOfWorkProcessor(this, target);
+ //UnitOfWorkProcessor unitOfWorkProcessor = new UnitOfWorkProcessor(this, target);
- CamelInternalProcessor internal = new CamelInternalProcessor(unitOfWorkProcessor);
+ CamelInternalProcessor internal = new CamelInternalProcessor(target);
+ internal.addTask(new CamelInternalProcessor.UnitOfWorkProcessorTask(routeId));
// and then optionally add route policy processor if a custom policy is set
List<RoutePolicy> routePolicyList = getRoutePolicyList();
@@ -174,7 +177,6 @@ public class DefaultRouteContext implements RouteContext {
}
// wrap in route inflight processor to track number of inflight exchanges for the route
- String routeId = route.idOrCreate(getCamelContext().getNodeIdFactory());
internal.addTask(new CamelInternalProcessor.RouteInflightRepositoryTask(camelContext.getInflightRepository(), routeId));
// TODO: This should be a task as well
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
index 5e73115..b04d6b9 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
@@ -29,6 +29,8 @@ import org.apache.camel.Processor;
import org.apache.camel.Route;
import org.apache.camel.StatefulService;
import org.apache.camel.api.management.PerformanceCounter;
+import org.apache.camel.impl.DefaultUnitOfWork;
+import org.apache.camel.impl.MDCUnitOfWork;
import org.apache.camel.management.DelegatePerformanceCounter;
import org.apache.camel.management.mbean.ManagedPerformanceCounter;
import org.apache.camel.model.ProcessorDefinition;
@@ -46,10 +48,11 @@ import org.slf4j.LoggerFactory;
/**
* Internal {@link Processor} that Camel routing engine used during routing for cross cutting functionality such as:
* <ul>
+ * <li>Execute {@link UnitOfWork}</li>
* <li>Keeping track which route currently is being routed</li>
+ * <li>Execute {@link RoutePolicy}</li>
* <li>Gather JMX performance statics</li>
* <li>Tracing</li>
- * <li>Execute {@link RoutePolicy}</li>
* </ul>
* ... and much more.
* <p/>
@@ -115,9 +118,17 @@ public final class CamelInternalProcessor extends DelegateAsyncProcessor {
// create internal callback which will execute the tasks in reverse order when done
callback = new InternalCallback(states, exchange, callback);
- if (exchange.isTransacted()) {
+ // UNIT_OF_WORK_PROCESS_SYNC is @deprecated and we should remove it from Camel 3.0
+ Object synchronous = exchange.removeProperty(Exchange.UNIT_OF_WORK_PROCESS_SYNC);
+ if (exchange.isTransacted() || synchronous != null) {
// must be synchronized for transacted exchanges
- LOG.trace("Transacted Exchange must be routed synchronously for exchangeId: {} -> {}", exchange.getExchangeId(), exchange);
+ if (LOG.isTraceEnabled()) {
+ if (exchange.isTransacted()) {
+ LOG.trace("Transacted Exchange must be routed synchronously for exchangeId: {} -> {}", exchange.getExchangeId(), exchange);
+ } else {
+ LOG.trace("Synchronous UnitOfWork Exchange must be routed synchronously for exchangeId: {} -> {}", exchange.getExchangeId(), exchange);
+ }
+ }
try {
processor.process(exchange);
} catch (Throwable e) {
@@ -135,6 +146,9 @@ public final class CamelInternalProcessor extends DelegateAsyncProcessor {
async = uow.beforeProcess(processor, exchange, callback);
}
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Processing exchange for exchangeId: {} -> {}", exchange.getExchangeId(), exchange);
+ }
boolean sync = processor.process(exchange, async);
// execute any after processor work (in current thread, not in the callback)
@@ -414,4 +428,80 @@ public final class CamelInternalProcessor extends DelegateAsyncProcessor {
}
}
+ public static class UnitOfWorkProcessorTask implements CamelInternalProcessorTask<UnitOfWork> {
+
+ private final String routeId;
+
+ public UnitOfWorkProcessorTask(String routeId) {
+ this.routeId = routeId;
+ }
+
+ @Override
+ public UnitOfWork before(Exchange exchange) throws Exception {
+ // if the exchange doesn't have from route id set, then set it if it originated
+ // from this unit of work
+ if (routeId != null && exchange.getFromRouteId() == null) {
+ exchange.setFromRouteId(routeId);
+ }
+
+ if (exchange.getUnitOfWork() == null) {
+ // If there is no existing UoW, then we should start one and
+ // terminate it once processing is completed for the exchange.
+ final UnitOfWork uow = createUnitOfWork(exchange);
+ exchange.setUnitOfWork(uow);
+ uow.start();
+ return uow;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void after(Exchange exchange, UnitOfWork uow) throws Exception {
+ if (uow != null) {
+ doneUow(uow, exchange);
+ }
+ }
+
+ /**
+ * Strategy to create the unit of work for the given exchange.
+ *
+ * @param exchange the exchange
+ * @return the created unit of work
+ */
+ protected UnitOfWork createUnitOfWork(Exchange exchange) {
+ UnitOfWork answer;
+ if (exchange.getContext().isUseMDCLogging()) {
+ answer = new MDCUnitOfWork(exchange);
+ } else {
+ answer = new DefaultUnitOfWork(exchange);
+ }
+ return answer;
+ }
+
+ private void doneUow(UnitOfWork uow, Exchange exchange) {
+ // unit of work is done
+ try {
+ if (uow != null) {
+ uow.done(exchange);
+ }
+ } catch (Throwable e) {
+ LOG.warn("Exception occurred during done UnitOfWork for Exchange: " + exchange
+ + ". This exception will be ignored.", e);
+ }
+ try {
+ if (uow != null) {
+ uow.stop();
+ }
+ } catch (Throwable e) {
+ LOG.warn("Exception occurred during stopping UnitOfWork for Exchange: " + exchange
+ + ". This exception will be ignored.", e);
+ }
+
+ // remove uow from exchange as its done
+ exchange.setUnitOfWork(null);
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
index aecad64..69248f0 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
@@ -341,6 +341,7 @@ public class DefaultChannel extends ServiceSupport implements ModelChannel {
}
public boolean process(final Exchange exchange, final AsyncCallback callback) {
+ // TODO: This logic can be in internal processor
if (!continueProcessing(exchange)) {
// we should not continue routing so we are done
callback.done(true);
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java b/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java
index 97c37e2..aba0408 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ChoiceWithEndTest.java
@@ -34,8 +34,6 @@ public class ChoiceWithEndTest extends ContextTestSupport {
// use navigate to find that the end works as expected
Navigate<Processor> nav = getRoute("direct://start").navigate();
List<Processor> node = nav.next();
- node = ((Navigate<Processor>) node.get(0)).next();
- node = ((Navigate<Processor>) node.get(0)).next();
// there should be 4 outputs as the end in the otherwise should
// ensure that the transform and last send is not within the choice
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java b/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java
index 6bd79db..2aae4f1 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/NavigateRouteTest.java
@@ -42,7 +42,7 @@ public class NavigateRouteTest extends ContextTestSupport {
Navigate<Processor> nav = context.getRoutes().get(0).navigate();
navigateRoute(nav);
- assertEquals("There should be 8 processors to navigate", 8, count);
+ assertEquals("There should be 6 processors to navigate", 6, count);
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java b/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
index 3b51222..2d3000c 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
@@ -74,18 +74,10 @@ public class RandomLoadBalanceJavaDSLBuilderTest extends RandomLoadBalanceTest {
return;
}
- for (Processor child : nav.next()) {
-
- if (child instanceof RouteContextProcessor) {
- child = ((RouteContextProcessor) child).getProcessor();
- }
-
- if (child instanceof DefaultChannel) {
- DefaultChannel channel = (DefaultChannel) child;
- ProcessorDefinition<?> def = channel.getProcessorDefinition();
- navigateDefinition(def, sb);
- }
-
+ if (nav instanceof DefaultChannel) {
+ DefaultChannel channel = (DefaultChannel) nav;
+ ProcessorDefinition<?> def = channel.getProcessorDefinition();
+ navigateDefinition(def, sb);
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java b/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
index e6b4a6c..bf8c997 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/ReduceStacksNeededDuringRoutingTest.java
@@ -54,8 +54,6 @@ public class ReduceStacksNeededDuringRoutingTest extends ContextTestSupport {
try {
throw new IllegalArgumentException("Forced to dump stacktrace");
} catch (Exception e) {
- log.error("Dump stacktrace to log", e);
-
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
@@ -69,6 +67,7 @@ public class ReduceStacksNeededDuringRoutingTest extends ContextTestSupport {
count++;
}
log.info("There is " + count + " lines in the stacktrace");
+ log.error("Dump stacktrace to log", e);
}
}
})
http://git-wip-us.apache.org/repos/asf/camel/blob/9ede1339/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java
index f80f53f..3b34ad2 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitWithEndTest.java
@@ -35,8 +35,6 @@ public class SplitWithEndTest extends ContextTestSupport {
// use navigate to find that the end works as expected
Navigate<Processor> nav = context.getRoutes().get(0).navigate();
List<Processor> node = nav.next();
- node = ((Navigate<Processor>) node.get(0)).next();
- node = ((Navigate<Processor>) node.get(0)).next();
// there should be 4 outputs as the end in the otherwise should
// ensure that the transform and last send is not within the choice
[3/8] git commit: Fixed simple language routeId function to return
the id of the current route and not the originated route.
Posted by da...@apache.org.
Fixed simple language routeId function to return the id of the current route and not the originated route.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9708a102
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9708a102
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9708a102
Branch: refs/heads/master
Commit: 9708a102b968bb9bb5e575bec3031cab3500f9b1
Parents: 9ede133
Author: Claus Ibsen <da...@apache.org>
Authored: Mon May 20 18:24:40 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:38 2013 +0200
----------------------------------------------------------------------
.../apache/camel/builder/ExpressionBuilder.java | 9 ++++++-
.../apache/camel/processor/CorrectRouteIdTest.java | 20 +++++++++++++++
2 files changed, 28 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9708a102/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
index 0d135bd..c4fbce2 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
@@ -43,6 +43,8 @@ import org.apache.camel.component.properties.PropertiesComponent;
import org.apache.camel.language.bean.BeanLanguage;
import org.apache.camel.model.language.MethodCallExpression;
import org.apache.camel.spi.Language;
+import org.apache.camel.spi.RouteContext;
+import org.apache.camel.spi.UnitOfWork;
import org.apache.camel.support.ExpressionAdapter;
import org.apache.camel.support.TokenPairExpressionIterator;
import org.apache.camel.support.TokenXMLPairExpressionIterator;
@@ -1400,7 +1402,12 @@ public final class ExpressionBuilder {
public static Expression routeIdExpression() {
return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
- return exchange.getFromRouteId();
+ UnitOfWork uow = exchange.getUnitOfWork();
+ RouteContext rc = uow != null ? uow.getRouteContext() : null;
+ if (rc != null) {
+ return rc.getRoute().getId();
+ }
+ return null;
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/9708a102/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java b/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java
new file mode 100644
index 0000000..f5a5661
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java
@@ -0,0 +1,20 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+public class CorrectRouteIdTest {
+}
[8/8] git commit: CAMEL-6377: Optimized routing engine to reduce
stack frames in use during routing. Work in progress.
Posted by da...@apache.org.
CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/44086237
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/44086237
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/44086237
Branch: refs/heads/master
Commit: 4408623727f089637754ac8d36b2907991a620ba
Parents: e80810f
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 21 07:37:29 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:39 2013 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/impl/MDCUnitOfWork.java | 33 +--------------
camel-core/src/test/resources/log4j.properties | 2 +-
2 files changed, 3 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/44086237/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java b/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
index 62f6b16..6565887 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
@@ -184,46 +184,17 @@ public class MDCUnitOfWork extends DefaultUnitOfWork {
private static final class MDCCallback implements AsyncCallback {
private final AsyncCallback delegate;
- private final String breadcrumbId;
- private final String exchangeId;
- private final String messageId;
- private final String correlationId;
private final String routeId;
- private final String camelContextId;
private MDCCallback(AsyncCallback delegate) {
this.delegate = delegate;
- this.exchangeId = MDC.get(MDC_EXCHANGE_ID);
- this.messageId = MDC.get(MDC_MESSAGE_ID);
- this.breadcrumbId = MDC.get(MDC_BREADCRUMB_ID);
- this.correlationId = MDC.get(MDC_CORRELATION_ID);
- this.camelContextId = MDC.get(MDC_CAMEL_CONTEXT_ID);
+ // we only need to keep track of route id as we may change routes during routing
this.routeId = MDC.get(MDC_ROUTE_ID);
}
public void done(boolean doneSync) {
try {
- if (!doneSync) {
- // when done asynchronously then restore information from previous thread
- if (breadcrumbId != null) {
- MDC.put(MDC_BREADCRUMB_ID, breadcrumbId);
- }
- if (exchangeId != null) {
- MDC.put(MDC_EXCHANGE_ID, exchangeId);
- }
- if (messageId != null) {
- MDC.put(MDC_MESSAGE_ID, messageId);
- }
- if (correlationId != null) {
- MDC.put(MDC_CORRELATION_ID, correlationId);
- }
- if (routeId != null) {
- MDC.put(MDC_ROUTE_ID, routeId);
- }
- if (camelContextId != null) {
- MDC.put(MDC_CAMEL_CONTEXT_ID, camelContextId);
- }
- }
+ MDC.put(MDC_ROUTE_ID, routeId);
} finally {
// muse ensure delegate is invoked
delegate.done(doneSync);
http://git-wip-us.apache.org/repos/asf/camel/blob/44086237/camel-core/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/camel-core/src/test/resources/log4j.properties b/camel-core/src/test/resources/log4j.properties
index 21ecb02..55b0834 100644
--- a/camel-core/src/test/resources/log4j.properties
+++ b/camel-core/src/test/resources/log4j.properties
@@ -59,7 +59,7 @@ log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
# MDC
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camelexchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
# File appender
log4j.appender.file=org.apache.log4j.FileAppender
[5/8] git commit: Upgraded to latest mqtt client and hawt dispatch
Posted by da...@apache.org.
Upgraded to latest mqtt client and hawt dispatch
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8b397869
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8b397869
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8b397869
Branch: refs/heads/master
Commit: 8b39786962f71522861b792bfdb07b82e8285f48
Parents: c50d48a
Author: Claus Ibsen <da...@apache.org>
Authored: Mon May 20 18:39:17 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:38 2013 +0200
----------------------------------------------------------------------
parent/pom.xml | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8b397869/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index abcc936..29bb9ed 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -163,7 +163,7 @@
<hapi-version>2.0</hapi-version>
<hawtbuf-version>1.9</hawtbuf-version>
<hawtdb-version>1.6</hawtdb-version>
- <hawtdispatch-version>1.13</hawtdispatch-version>
+ <hawtdispatch-version>1.17</hawtdispatch-version>
<hazelcast-version>2.5</hazelcast-version>
<hbase-version>0.94.3</hbase-version>
<hbase-bundle-version>0.94.3_1</hbase-bundle-version>
@@ -277,7 +277,7 @@
<mock-javamail-version>1.7</mock-javamail-version>
<mockito-version>1.9.5</mockito-version>
<mongo-java-driver-version>2.9.1</mongo-java-driver-version>
- <mqtt-client-version>1.4</mqtt-client-version>
+ <mqtt-client-version>1.5</mqtt-client-version>
<msv-version>20050913</msv-version>
<mvel-version>2.1.3.Final</mvel-version>
<mybatis-version>3.2.2</mybatis-version>
[7/8] git commit: Fixed simple language routeId function to return
the id of the current route and not the originated route.
Posted by da...@apache.org.
Fixed simple language routeId function to return the id of the current route and not the originated route.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e80810fd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e80810fd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e80810fd
Branch: refs/heads/master
Commit: e80810fdb414b9d51de407ff19e33147d8c0e8a3
Parents: 462f00e
Author: Claus Ibsen <da...@apache.org>
Authored: Tue May 21 06:34:10 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:39 2013 +0200
----------------------------------------------------------------------
.../apache/camel/builder/ExpressionBuilder.java | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e80810fd/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
index c4fbce2..3527140 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
@@ -1402,12 +1402,17 @@ public final class ExpressionBuilder {
public static Expression routeIdExpression() {
return new ExpressionAdapter() {
public Object evaluate(Exchange exchange) {
+ String answer = null;
UnitOfWork uow = exchange.getUnitOfWork();
RouteContext rc = uow != null ? uow.getRouteContext() : null;
if (rc != null) {
- return rc.getRoute().getId();
+ answer = rc.getRoute().getId();
}
- return null;
+ if (answer == null) {
+ // fallback and get from route id on the exchange
+ answer = exchange.getFromRouteId();
+ }
+ return answer;
}
@Override
[4/8] git commit: CAMEL-6377: Optimized routing engine to reduce
stack frames in use during routing. Work in progress.
Posted by da...@apache.org.
CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/50154f3b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/50154f3b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/50154f3b
Branch: refs/heads/master
Commit: 50154f3b0fc7a888f756f1bf587d19a788c537b4
Parents: 8b39786
Author: Claus Ibsen <da...@apache.org>
Authored: Mon May 20 18:57:05 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:38 2013 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/DefaultRouteContext.java | 3 +++
.../processor/interceptor/DefaultChannel.java | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/50154f3b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
index 3bcb8e8..f0abf2c 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
@@ -155,6 +155,9 @@ public class DefaultRouteContext implements RouteContext {
CamelInternalProcessor internal = new CamelInternalProcessor(target);
internal.addTask(new CamelInternalProcessor.UnitOfWorkProcessorTask(routeId));
+ // and then in route context so we can keep track which route this is at runtime
+ internal.addTask(new CamelInternalProcessor.RouteContextTask(this));
+
// and then optionally add route policy processor if a custom policy is set
List<RoutePolicy> routePolicyList = getRoutePolicyList();
if (routePolicyList != null && !routePolicyList.isEmpty()) {
http://git-wip-us.apache.org/repos/asf/camel/blob/50154f3b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
index 69248f0..41c002d 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultChannel.java
@@ -164,8 +164,6 @@ public class DefaultChannel extends ServiceSupport implements ModelChannel {
this.definition = outputDefinition;
this.camelContext = routeContext.getCamelContext();
this.internalProcessor = new CamelInternalProcessor();
- // TODO: The route context task can likely be only added in DefaultRouteContext once per route
- this.internalProcessor.addTask(new CamelInternalProcessor.RouteContextTask(routeContext));
Processor target = nextProcessor;
Processor next;
[2/8] git commit: CAMEL-6377: Optimized routing engine to reduce
stack frames in use during routing. Work in progress.
Posted by da...@apache.org.
CAMEL-6377: Optimized routing engine to reduce stack frames in use during routing. Work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c50d48ac
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c50d48ac
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c50d48ac
Branch: refs/heads/master
Commit: c50d48ac36375a07049b32974991d22938a2ed72
Parents: 9708a10
Author: Claus Ibsen <da...@apache.org>
Authored: Mon May 20 18:27:18 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue May 21 07:43:38 2013 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/DefaultRouteContext.java | 3 -
.../apache/camel/processor/CorrectRouteIdTest.java | 38 ++++++++++++++-
2 files changed, 37 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c50d48ac/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
index 07c3235..3bcb8e8 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
@@ -36,7 +36,6 @@ import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.processor.CamelInternalProcessor;
import org.apache.camel.processor.Pipeline;
-import org.apache.camel.processor.UnitOfWorkProcessor;
import org.apache.camel.spi.InterceptStrategy;
import org.apache.camel.spi.RouteContext;
import org.apache.camel.spi.RoutePolicy;
@@ -153,8 +152,6 @@ public class DefaultRouteContext implements RouteContext {
String routeId = route.idOrCreate(getCamelContext().getNodeIdFactory());
// and wrap it in a unit of work so the UoW is on the top, so the entire route will be in the same UoW
- //UnitOfWorkProcessor unitOfWorkProcessor = new UnitOfWorkProcessor(this, target);
-
CamelInternalProcessor internal = new CamelInternalProcessor(target);
internal.addTask(new CamelInternalProcessor.UnitOfWorkProcessorTask(routeId));
http://git-wip-us.apache.org/repos/asf/camel/blob/c50d48ac/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java b/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java
index f5a5661..f91e7e2 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/CorrectRouteIdTest.java
@@ -16,5 +16,41 @@
*/
package org.apache.camel.processor;
-public class CorrectRouteIdTest {
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class CorrectRouteIdTest extends ContextTestSupport {
+
+ public void testCorrectRouteId() throws Exception {
+ getMockEndpoint("mock:foo").expectedHeaderReceived("foo", "foo");
+ getMockEndpoint("mock:bar").expectedHeaderReceived("bar", "bar");
+ getMockEndpoint("mock:baz").expectedHeaderReceived("baz", "baz");
+
+ template.requestBody("direct:foo", "Hello World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:foo").routeId("foo")
+ .setHeader("foo").simple("routeId")
+ .to("mock:foo")
+ .to("seda:bar")
+ .to("mock:result");
+
+ from("seda:bar").routeId("bar")
+ .setHeader("bar").simple("routeId")
+ .to("mock:bar")
+ .to("direct:baz");
+
+ from("direct:baz").routeId("baz")
+ .setHeader("baz").simple("routeId")
+ .to("mock:baz");
+ }
+ };
+ }
}