You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2019/01/30 11:54:17 UTC
[aries-jpa] branch master updated: [ARIES-1885] End coordination in
case of exception in JpaInterceptor
This is an automated email from the ASF dual-hosted git repository.
cschneider pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-jpa.git
The following commit(s) were added to refs/heads/master by this push:
new f637f77 [ARIES-1885] End coordination in case of exception in JpaInterceptor
new a5145cd Merge pull request #6 from nicolas-dutertry/ARIES-1885
f637f77 is described below
commit f637f77f75500eb0932e48b4e421fa3a32322918
Author: Nicolas Dutertry <ni...@soprahr.com>
AuthorDate: Wed Jan 30 10:21:13 2019 +0100
[ARIES-1885] End coordination in case of exception in JpaInterceptor
---
.../apache/aries/jpa/blueprint/impl/JpaInterceptor.java | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java b/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java
index a6d5bf2..009908d 100644
--- a/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java
+++ b/jpa-blueprint/src/main/java/org/apache/aries/jpa/blueprint/impl/JpaInterceptor.java
@@ -81,7 +81,9 @@ public class JpaInterceptor implements Interceptor {
public void postCallWithException(ComponentMetadata cm, Method m, Throwable ex, Object preCallToken) {
LOG.debug("PostCallWithException for bean {}, method {}", cm.getId(), m.getName(), ex);
if (preCallToken != null) {
- ((Coordination)preCallToken).fail(ex);
+ Coordination coordination = (Coordination)preCallToken;
+ coordination.fail(ex);
+ safeEndCoordination(coordination);
}
}
@@ -90,7 +92,7 @@ public class JpaInterceptor implements Interceptor {
throws Exception {
LOG.debug("PostCallWithReturn for bean {}, method {}", cm.getId(), m.getName());
if (preCallToken != null) {
- ((Coordination)preCallToken).end();
+ safeEndCoordination((Coordination)preCallToken);
}
}
@@ -110,4 +112,14 @@ public class JpaInterceptor implements Interceptor {
.get(PersistenceUnitTransactionType.class.getName());
return transactionType == PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
+
+ private void safeEndCoordination(final Coordination coordination) {
+ try {
+ if (coordination != null) {
+ coordination.end();
+ }
+ } catch (Exception e){
+ LOG.debug(e.getMessage(), e);
+ }
+ }
}