You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2018/01/18 17:08:43 UTC

[aries-tx-control] 03/04: tx-control-service spec compliance Post-Completion callback exceptions must be logged, but not re-thrown to the client

This is an automated email from the ASF dual-hosted git repository.

timothyjward pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-tx-control.git

commit 46fe11f82e0d045a57e7f51f94748afeb57905c1
Author: Tim Ward <ti...@apache.org>
AuthorDate: Thu Jan 18 16:53:31 2018 +0000

    tx-control-service spec compliance
    Post-Completion callback exceptions must be logged, but not re-thrown to the client
---
 .../service/common/impl/AbstractTransactionContextImpl.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tx-control-services/tx-control-service-common/src/main/java/org/apache/aries/tx/control/service/common/impl/AbstractTransactionContextImpl.java b/tx-control-services/tx-control-service-common/src/main/java/org/apache/aries/tx/control/service/common/impl/AbstractTransactionContextImpl.java
index 5bda0ee..9c8337a 100644
--- a/tx-control-services/tx-control-service-common/src/main/java/org/apache/aries/tx/control/service/common/impl/AbstractTransactionContextImpl.java
+++ b/tx-control-services/tx-control-service-common/src/main/java/org/apache/aries/tx/control/service/common/impl/AbstractTransactionContextImpl.java
@@ -27,9 +27,13 @@ import java.util.function.Consumer;
 
 import org.osgi.service.transaction.control.TransactionContext;
 import org.osgi.service.transaction.control.TransactionStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public abstract class AbstractTransactionContextImpl implements TransactionContext {
 
+	private static final Logger logger = LoggerFactory.getLogger(AbstractTransactionContextImpl.class);
+	
 	protected final AtomicReference<Throwable> firstUnexpectedException = new AtomicReference<>();
 
 	protected final List<Throwable> subsequentExceptions = new ArrayList<>();
@@ -60,7 +64,7 @@ public abstract class AbstractTransactionContextImpl implements TransactionConte
 				} else {
 					subsequentExceptions.add(e);
 				}
-				// TODO log this
+				logger.warn("A pre-completion callback failed with an exception", e);
 			}
 		});
 	}
@@ -70,8 +74,8 @@ public abstract class AbstractTransactionContextImpl implements TransactionConte
 			try {
 				c.accept(status);
 			} catch (Exception e) {
-				recordFailure(e);
-				// TODO log this
+				// Post completion failures do not affect the outcome
+				logger.warn("A post-completion callback failed with an exception", e);
 			}
 		});
 	}

-- 
To stop receiving notification emails like this one, please contact
"commits@aries.apache.org" <co...@aries.apache.org>.