[jboss-cvs] JBossAS SVN: r109871 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/async/impl/interceptor.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 13 07:46:35 EST 2010


Author: ALRubinger
Date: 2010-12-13 07:46:35 -0500 (Mon, 13 Dec 2010)
New Revision: 109871

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/async/impl/interceptor/AsynchronousServerInterceptor.java
Log:
[EJBTHREE-1721] Do not propagate exceptions to the client on async invocations if the return type is void

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/async/impl/interceptor/AsynchronousServerInterceptor.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/async/impl/interceptor/AsynchronousServerInterceptor.java	2010-12-13 12:16:42 UTC (rev 109870)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/async/impl/interceptor/AsynchronousServerInterceptor.java	2010-12-13 12:46:35 UTC (rev 109871)
@@ -22,6 +22,7 @@
 package org.jboss.ejb3.async.impl.interceptor;
 
 import java.io.Serializable;
+import java.lang.reflect.Method;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
@@ -32,6 +33,7 @@
 import org.jboss.aop.Advisor;
 import org.jboss.aop.advice.Interceptor;
 import org.jboss.aop.joinpoint.Invocation;
+import org.jboss.aop.joinpoint.MethodInvocation;
 import org.jboss.ejb3.EJBContainer;
 import org.jboss.ejb3.async.impl.SerializableFuture;
 import org.jboss.ejb3.async.spi.AsyncInvocationId;
@@ -143,6 +145,19 @@
 
          return returnValue;
       }
+      catch(final Throwable t)
+      {
+         // Only propagate this back if the return type is not void, else swallow the exception
+         final MethodInvocation mi = (MethodInvocation) invocation;
+         final Method m = mi.getActualMethod();
+         final Class<?> returnType = m.getReturnType();
+         if (void.class.equals(returnType))
+         {
+            log.debug("Received Throwable on @Asynchronous invocation " + m + ", not returning to the client:", t);
+            return null;
+         }
+         throw t;
+      }
       finally
       {
          // Remove the invocation from the Map of those currently-executed



More information about the jboss-cvs-commits mailing list