Polished
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e53b636e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e53b636e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e53b636e Branch: refs/heads/master Commit: e53b636e39f3cd20bea84c0b03ad748f84f10fab Parents: 0d25645 Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Jun 1 20:11:37 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Jun 1 20:11:37 2017 +0200 ---------------------------------------------------------------------- .../java/org/apache/camel/component/timer/TimerEndpoint.java | 8 ++++---- .../org/apache/camel/model/OptionalIdentifiedDefinition.java | 2 +- .../org/apache/camel/processor/CamelInternalProcessor.java | 5 +++-- .../src/main/java/org/apache/camel/util/StopWatch.java | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/e53b636e/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java index 580ee8a..c9e8ca9 100644 --- a/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java +++ b/camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java @@ -97,7 +97,10 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS @Override protected void doStart() throws Exception { super.doStart(); - // do nothing, the timer will be set when the first consumer will request it + if (timerName == null) { + timerName = getEndpointUri(); + } + // do nothing in regards to setTimer, the timer will be set when the first consumer will request it } @Override @@ -113,9 +116,6 @@ public class TimerEndpoint extends DefaultEndpoint implements MultipleConsumersS @ManagedAttribute(description = "Timer Name") public String getTimerName() { - if (timerName == null) { - timerName = getEndpointUri(); - } return timerName; } http://git-wip-us.apache.org/repos/asf/camel/blob/e53b636e/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java index ab346d8..e2c4290 100644 --- a/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/OptionalIdentifiedDefinition.java @@ -157,7 +157,7 @@ public abstract class OptionalIdentifiedDefinition<T extends OptionalIdentifiedD if (id == null) { id = factory.createId(this); } - return getId(); + return id; } public Boolean getCustomId() { http://git-wip-us.apache.org/repos/asf/camel/blob/e53b636e/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 82d26c1..1ba6c0c 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 @@ -633,17 +633,18 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor { public static class UnitOfWorkProcessorAdvice implements CamelInternalProcessorAdvice<UnitOfWork> { private final RouteContext routeContext; + private final String routeId; public UnitOfWorkProcessorAdvice(RouteContext routeContext) { this.routeContext = routeContext; + this.routeId = routeContext.getRoute().idOrCreate(routeContext.getCamelContext().getNodeIdFactory()); } @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 (routeContext != null && exchange.getFromRouteId() == null) { - String routeId = routeContext.getRoute().idOrCreate(routeContext.getCamelContext().getNodeIdFactory()); + if (routeContext != null && exchange.getFromRouteId() == null && routeId != null) { exchange.setFromRouteId(routeId); } http://git-wip-us.apache.org/repos/asf/camel/blob/e53b636e/camel-core/src/main/java/org/apache/camel/util/StopWatch.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/StopWatch.java b/camel-core/src/main/java/org/apache/camel/util/StopWatch.java index 831eb89..070256f 100644 --- a/camel-core/src/main/java/org/apache/camel/util/StopWatch.java +++ b/camel-core/src/main/java/org/apache/camel/util/StopWatch.java @@ -33,7 +33,7 @@ public final class StopWatch { * Starts the stop watch */ public StopWatch() { - this(true); + this.start = System.currentTimeMillis(); } /**