CAMEL-10685: Fix Checkstyle errors
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ac7bb06c Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ac7bb06c Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ac7bb06c Branch: refs/heads/master Commit: ac7bb06cd90804bf6acc6b31c91790633ea2e273 Parents: 6aecd51 Author: Antonin Stefanutti <anto...@stefanutti.fr> Authored: Thu Apr 13 15:21:56 2017 +0200 Committer: Antonin Stefanutti <anto...@stefanutti.fr> Committed: Thu Apr 13 16:52:19 2017 +0200 ---------------------------------------------------------------------- .../org/apache/camel/cdi/CdiCamelExtension.java | 22 +++++----- .../org/apache/camel/cdi/JtaRouteBuilder.java | 16 +++++++ .../transaction/JtaTransactionErrorHandler.java | 16 +++++++ .../JtaTransactionErrorHandlerBuilder.java | 26 ++++++++--- .../cdi/transaction/JtaTransactionPolicy.java | 18 +++++++- .../MandatoryJtaTransactionPolicy.java | 16 +++++++ .../transaction/NestedJtaTransactionPolicy.java | 18 +++++++- .../transaction/NeverJtaTransactionPolicy.java | 16 +++++++ .../NotSupportedJtaTransactionPolicy.java | 16 +++++++ .../RequiredJtaTransactionPolicy.java | 16 +++++++ .../RequiresNewJtaTransactionPolicy.java | 16 +++++++ .../SupportsJtaTransactionPolicy.java | 16 +++++++ .../cdi/transaction/TransactedDefinition.java | 16 +++++++ .../transaction/TransactionErrorHandler.java | 45 ++++++++++++++------ .../TransactionalJtaTransactionPolicy.java | 16 +++++++ 15 files changed, 257 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java index 8862476..1de2d72 100755 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java @@ -416,17 +416,17 @@ public class CdiCamelExtension implements Extension { // Start Camel contexts if (configuration.autoStartContexts()) { - for (CamelContext context : contexts) { - if (ServiceStatus.Started.equals(context.getStatus())) { - continue; - } - logger.info("Camel CDI is starting Camel context [{}]", context.getName()); - try { - context.start(); - } catch (Exception exception) { - adv.addDeploymentProblem(exception); - } - } + for (CamelContext context : contexts) { + if (ServiceStatus.Started.equals(context.getStatus())) { + continue; + } + logger.info("Camel CDI is starting Camel context [{}]", context.getName()); + try { + context.start(); + } catch (Exception exception) { + adv.addDeploymentProblem(exception); + } + } } // Clean-up http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/JtaRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/JtaRouteBuilder.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/JtaRouteBuilder.java index 0791954..3180ae1 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/JtaRouteBuilder.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/JtaRouteBuilder.java @@ -1,3 +1,19 @@ +/** + * 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.cdi; import org.apache.camel.builder.RouteBuilder; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandler.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandler.java index 867d23b..f7b89ee 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandler.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandler.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import java.util.concurrent.ScheduledExecutorService; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandlerBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandlerBuilder.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandlerBuilder.java index 2020763..4823cc6 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandlerBuilder.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionErrorHandlerBuilder.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import java.util.Map; @@ -22,13 +38,13 @@ import org.slf4j.LoggerFactory; */ public class JtaTransactionErrorHandlerBuilder extends DefaultErrorHandlerBuilder { + public static final String ROLLBACK_LOGGING_LEVEL_PROPERTY = + JtaTransactionErrorHandlerBuilder.class.getName() + "#rollbackLoggingLevel"; + private static final Logger LOG = LoggerFactory.getLogger(JtaTransactionErrorHandlerBuilder.class); private static final String PROPAGATION_REQUIRED = "PROPAGATION_REQUIRED"; - public static final String ROLLBACK_LOGGING_LEVEL_PROPERTY = JtaTransactionErrorHandlerBuilder.class.getName() - + "#rollbackLoggingLevel"; - private LoggingLevel rollbackLoggingLevel = LoggingLevel.WARN; private JtaTransactionPolicy transactionPolicy; @@ -94,14 +110,14 @@ public class JtaTransactionErrorHandlerBuilder extends DefaultErrorHandlerBuilde if (mapPolicy != null && mapPolicy.size() == 1) { TransactedPolicy policy = mapPolicy.values().iterator().next(); if (policy != null && policy instanceof JtaTransactionPolicy) { - transactionPolicy = ((JtaTransactionPolicy) policy); + transactionPolicy = (JtaTransactionPolicy) policy; } } if (transactionPolicy == null) { TransactedPolicy policy = routeContext.lookup(PROPAGATION_REQUIRED, TransactedPolicy.class); if (policy != null && policy instanceof JtaTransactionPolicy) { - transactionPolicy = ((JtaTransactionPolicy) policy); + transactionPolicy = (JtaTransactionPolicy) policy; } } http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java index ff2a8ab..164d190 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/JtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.annotation.Resource; @@ -25,7 +41,7 @@ public abstract class JtaTransactionPolicy implements TransactedPolicy { private static final Logger LOG = LoggerFactory.getLogger(JtaTransactionPolicy.class); - public static interface Runnable { + public interface Runnable { void run() throws Throwable; } http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java index c1f4224..44bb539 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/MandatoryJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.inject.Named; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NestedJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NestedJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NestedJtaTransactionPolicy.java index 72be5ed..d322235 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NestedJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NestedJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import java.util.logging.Level; @@ -9,7 +25,7 @@ import javax.transaction.Transaction; @Named("PROPAGATION_NESTED") public class NestedJtaTransactionPolicy extends TransactionalJtaTransactionPolicy { - private static final Logger logger = Logger.getLogger(NestedJtaTransactionPolicy.class.getCanonicalName()); + private final Logger logger = Logger.getLogger(NestedJtaTransactionPolicy.class.getCanonicalName()); @Override public void run(final Runnable runnable) throws Throwable { http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java index 3adda21..ad33372 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NeverJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.inject.Named; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NotSupportedJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NotSupportedJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NotSupportedJtaTransactionPolicy.java index 30eea29..5a0796d 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NotSupportedJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/NotSupportedJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.inject.Named; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiredJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiredJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiredJtaTransactionPolicy.java index 9ca448b..f938a45 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiredJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiredJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.inject.Named; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiresNewJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiresNewJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiresNewJtaTransactionPolicy.java index 607dbed..ab72aa1 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiresNewJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/RequiresNewJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.inject.Named; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/SupportsJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/SupportsJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/SupportsJtaTransactionPolicy.java index 1242610..ee6d85b 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/SupportsJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/SupportsJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.inject.Named; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactedDefinition.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactedDefinition.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactedDefinition.java index d84d585..c09e508 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactedDefinition.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactedDefinition.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import org.apache.camel.spi.Policy; http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java index 5f43d57..1d2b316 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionErrorHandler.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import java.util.ArrayList; @@ -32,6 +48,7 @@ public class TransactionErrorHandler extends ErrorHandlerSupport implements AsyncProcessor, ShutdownPrepared, Navigate<Processor> { protected final Processor output; + protected volatile boolean preparingShutdown; private ExceptionPolicyStrategy exceptionPolicy; @@ -149,7 +166,7 @@ public class TransactionErrorHandler extends ErrorHandlerSupport log.debug( "Transaction rollback ({}) redelivered({}) for {} " + "due exchange was marked for rollbackOnlyLast", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); } } // remove caused exception due we was marked as rollback only last @@ -234,7 +251,7 @@ public class TransactionErrorHandler extends ErrorHandlerSupport private void logTransactionBegin(String redelivered, String ids) { if (log.isDebugEnabled()) { log.debug("Transaction begin ({}) redelivered({}) for {})", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); } } @@ -250,14 +267,14 @@ public class TransactionErrorHandler extends ErrorHandlerSupport if (rollbackLoggingLevel == LoggingLevel.INFO || rollbackLoggingLevel == LoggingLevel.WARN || rollbackLoggingLevel == LoggingLevel.ERROR) { log.info("Transaction commit ({}) redelivered({}) for {})", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); // return after we have logged return; } } // log non redelivered by default at DEBUG level - log.debug("Transaction commit ({}) redelivered({}) for {})", new Object[] { transactionKey, redelivered, ids }); + log.debug("Transaction commit ({}) redelivered({}) for {})", new Object[] {transactionKey, redelivered, ids}); } /** @@ -269,42 +286,42 @@ public class TransactionErrorHandler extends ErrorHandlerSupport } else if (rollbackLoggingLevel == LoggingLevel.ERROR && log.isErrorEnabled()) { if (rollbackOnly) { log.error("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); } else { log.error("Transaction rollback ({}) redelivered({}) for {} caught: {}", - new Object[] { transactionKey, redelivered, ids, e.getMessage() }); + new Object[] {transactionKey, redelivered, ids, e.getMessage()}); } } else if (rollbackLoggingLevel == LoggingLevel.WARN && log.isWarnEnabled()) { if (rollbackOnly) { log.warn("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); } else { log.warn("Transaction rollback ({}) redelivered({}) for {} caught: {}", - new Object[] { transactionKey, redelivered, ids, e.getMessage() }); + new Object[] {transactionKey, redelivered, ids, e.getMessage()}); } } else if (rollbackLoggingLevel == LoggingLevel.INFO && log.isInfoEnabled()) { if (rollbackOnly) { log.info("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); } else { log.info("Transaction rollback ({}) redelivered({}) for {} caught: {}", - new Object[] { transactionKey, redelivered, ids, e.getMessage() }); + new Object[] {transactionKey, redelivered, ids, e.getMessage()}); } } else if (rollbackLoggingLevel == LoggingLevel.DEBUG && log.isDebugEnabled()) { if (rollbackOnly) { log.debug("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); } else { log.debug("Transaction rollback ({}) redelivered({}) for {} caught: {}", - new Object[] { transactionKey, redelivered, ids, e.getMessage() }); + new Object[] {transactionKey, redelivered, ids, e.getMessage()}); } } else if (rollbackLoggingLevel == LoggingLevel.TRACE && log.isTraceEnabled()) { if (rollbackOnly) { log.trace("Transaction rollback ({}) redelivered({}) for {} due exchange was marked for rollbackOnly", - new Object[] { transactionKey, redelivered, ids }); + new Object[] {transactionKey, redelivered, ids}); } else { log.trace("Transaction rollback ({}) redelivered({}) for {} caught: {}", - new Object[] { transactionKey, redelivered, ids, e.getMessage() }); + new Object[] {transactionKey, redelivered, ids, e.getMessage()}); } } } http://git-wip-us.apache.org/repos/asf/camel/blob/ac7bb06c/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionalJtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionalJtaTransactionPolicy.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionalJtaTransactionPolicy.java index 2fda0af..9316cd3 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionalJtaTransactionPolicy.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/transaction/TransactionalJtaTransactionPolicy.java @@ -1,3 +1,19 @@ +/** + * 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.cdi.transaction; import javax.transaction.HeuristicMixedException;