tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [1/2] tomee git commit: OPENEJB-2111 application exception support for @Asynchronous
Date Mon, 16 Mar 2015 18:48:45 GMT
Repository: tomee
Updated Branches:
  refs/heads/master ca3f6a239 -> 85649d332


OPENEJB-2111 application exception support for @Asynchronous


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/dd003ce0
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/dd003ce0
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/dd003ce0

Branch: refs/heads/master
Commit: dd003ce08a901394d70b050b4df459808b5360e6
Parents: ca3f6a2
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Mon Mar 16 19:46:40 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Mon Mar 16 19:48:37 2015 +0100

----------------------------------------------------------------------
 .../apache/openejb/async/AsynchronousPool.java   | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/dd003ce0/container/openejb-core/src/main/java/org/apache/openejb/async/AsynchronousPool.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/async/AsynchronousPool.java
b/container/openejb-core/src/main/java/org/apache/openejb/async/AsynchronousPool.java
index 7c6cc36..925671b 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/async/AsynchronousPool.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/async/AsynchronousPool.java
@@ -18,14 +18,14 @@
 package org.apache.openejb.async;
 
 import org.apache.openejb.AppContext;
+import org.apache.openejb.BeanContext;
+import org.apache.openejb.core.ExceptionType;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.loader.Options;
 import org.apache.openejb.util.DaemonThreadFactory;
 import org.apache.openejb.util.Duration;
 import org.apache.openejb.util.ExecutorBuilder;
 
-import javax.ejb.EJBException;
-import javax.ejb.NoSuchEJBException;
 import java.rmi.NoSuchObjectException;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Callable;
@@ -38,6 +38,8 @@ import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
+import javax.ejb.EJBException;
+import javax.ejb.NoSuchEJBException;
 
 /**
  * @version $Rev$ $Date$
@@ -226,11 +228,22 @@ public class AsynchronousPool {
 
             final boolean isExceptionUnchecked = e instanceof Error || e instanceof RuntimeException;
 
-            // throw checked excpetion and EJBException directly.
+            // throw checked exception and EJBException directly.
             if (!isExceptionUnchecked || e instanceof EJBException) {
                 throw new ExecutionException(e);
             }
 
+            final ThreadContext tc = ThreadContext.getThreadContext();
+            if (tc != null) {
+                final BeanContext bc = tc.getBeanContext();
+                if (bc != null) {
+                    final ExceptionType exceptionType = bc.getExceptionType(e);
+                    if (exceptionType == ExceptionType.APPLICATION) {
+                        throw new ExecutionException(Exception.class.cast(e));
+                    }
+                }
+            }
+
             // wrap unchecked exception with EJBException before throwing.
             throw e instanceof Exception ? new ExecutionException(new EJBException((Exception)
e))
                 : new ExecutionException(new EJBException(new Exception(e)));


Mime
View raw message