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 2015/09/25 16:28:50 UTC
[2/2] camel git commit: CAMEL-9164: Fixed WARN logging during stop
camel in blueprint due error handler mbean not there.
CAMEL-9164: Fixed WARN logging during stop camel in blueprint due error handler mbean not there.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2b6feb62
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2b6feb62
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2b6feb62
Branch: refs/heads/master
Commit: 2b6feb622ece62c077991953218e431a9acf7cf8
Parents: ba77a99
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Sep 25 16:26:39 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Sep 25 16:26:39 2015 +0200
----------------------------------------------------------------------
.../camel/builder/ErrorHandlerBuilderRef.java | 18 +++++++++++++++++-
.../DefaultManagementNamingStrategy.java | 4 ++--
2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/2b6feb62/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java b/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java
index 769ea34..ddb1948 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java
@@ -99,6 +99,18 @@ public class ErrorHandlerBuilderRef extends ErrorHandlerBuilderSupport {
* @return the error handler
*/
public static ErrorHandlerFactory lookupErrorHandlerBuilder(RouteContext routeContext, String ref) {
+ return lookupErrorHandlerBuilder(routeContext, ref, true);
+ }
+
+ /**
+ * Lookup the error handler by the given ref
+ *
+ * @param routeContext the route context
+ * @param ref reference id for the error handler
+ * @param mandatory whether the error handler must exists, if not a {@link org.apache.camel.NoSuchBeanException} is thrown
+ * @return the error handler
+ */
+ public static ErrorHandlerFactory lookupErrorHandlerBuilder(RouteContext routeContext, String ref, boolean mandatory) {
ErrorHandlerFactory answer;
// if the ref is the default then we do not have any explicit error handler configured
@@ -134,7 +146,11 @@ public class ErrorHandlerBuilderRef extends ErrorHandlerBuilderSupport {
}
} else {
// use specific configured error handler
- answer = routeContext.lookup(ref, ErrorHandlerBuilder.class);
+ if (mandatory) {
+ answer = routeContext.mandatoryLookup(ref, ErrorHandlerBuilder.class);
+ } else {
+ answer = routeContext.lookup(ref, ErrorHandlerBuilder.class);
+ }
}
return answer;
http://git-wip-us.apache.org/repos/asf/camel/blob/2b6feb62/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
index 07d11bd..0a03e4d 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java
@@ -166,7 +166,7 @@ public class DefaultManagementNamingStrategy implements ManagementNamingStrategy
// it has not then its an indirection and we should do some work to lookup the real builder
ref = builderRef.getRef();
- ErrorHandlerFactory refBuilder = ErrorHandlerBuilderRef.lookupErrorHandlerBuilder(routeContext, builderRef.getRef());
+ ErrorHandlerFactory refBuilder = ErrorHandlerBuilderRef.lookupErrorHandlerBuilder(routeContext, builderRef.getRef(), false);
if (refBuilder != null) {
builder = refBuilder;
}
@@ -178,7 +178,7 @@ public class DefaultManagementNamingStrategy implements ManagementNamingStrategy
builderRef = (ErrorHandlerBuilderRef) builder;
// does it refer to a non default error handler then do a 2nd lookup
if (!builderRef.getRef().equals(ErrorHandlerBuilderRef.DEFAULT_ERROR_HANDLER_BUILDER)) {
- refBuilder = ErrorHandlerBuilderRef.lookupErrorHandlerBuilder(routeContext, builderRef.getRef());
+ refBuilder = ErrorHandlerBuilderRef.lookupErrorHandlerBuilder(routeContext, builderRef.getRef(), false);
if (refBuilder != null) {
ref = builderRef.getRef();
builder = refBuilder;