You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ke...@apache.org on 2010/10/08 00:12:53 UTC
svn commit: r1005652 -
/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
Author: kelapure
Date: Thu Oct 7 22:12:53 2010
New Revision: 1005652
URL: http://svn.apache.org/viewvc?rev=1005652&view=rev
Log:
OWB-422 Support needed for PrePassivate, PostActivate, and AroundTimeout via EJBInterceptor.
https://issues.apache.org/jira/browse/OWB-422
Modified:
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java?rev=1005652&r1=1005651&r2=1005652&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java Thu Oct 7 22:12:53 2010
@@ -45,6 +45,7 @@ import javax.enterprise.context.spi.Crea
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
import javax.interceptor.AroundInvoke;
+import javax.interceptor.AroundTimeout;
import javax.interceptor.InvocationContext;
import org.apache.webbeans.config.OWBLogConst;
@@ -190,6 +191,11 @@ public class OpenWebBeansEjbInterceptor
}
}
+ if (this.contextual == null)
+ {
+ return ejbContext.proceed();
+ }
+
return callInterceptorsAndDecorators(ejbContext.getMethod(), ejbContext.getTarget(), ejbContext.getParameters(), ejbContext);
}
finally
@@ -411,7 +417,7 @@ public class OpenWebBeansEjbInterceptor
/**
* Find the ManagedBean that corresponds to an instance of an EJB class
* @param instance an instance of a class whose corresponding Managed Bean is to be searched for
- * @return the correspondin BaseEjbBean, null if not found
+ * @return the corresponding BaseEjbBean, null if not found
*/
private BaseEjbBean<?> findTargetBean(Object instance)
{
@@ -471,8 +477,6 @@ public class OpenWebBeansEjbInterceptor
Object rv = null;
BaseEjbBean<?> injectionTarget = this.contextual;
InterceptorDataImpl decoratorInterceptorDataImpl = null;
-
-
List<Object> decorators = null;
DelegateHandler delegateHandler = null;
List<Decorator<?>> decoratorStack = injectionTarget.getDecoratorStack();
@@ -558,6 +562,47 @@ public class OpenWebBeansEjbInterceptor
return rv;
}
+
+ /**
+ * Around Timeout.
+ * @param context invocation ctx
+ */
+ @AroundTimeout
+ public Object callAroundTimeouts(InvocationContext context) throws Exception
+ {
+ Object rv = null;
+ if (logger.wblWillLogTrace())
+ {
+ logger.debug("OWBEI:: @AroundTimeout entry. Trying to run Interceptors.");
+ }
+
+ if ((this.contextual != null) && WebBeansUtil.isContainsInterceptorMethod(this.contextual.getInterceptorStack(), InterceptorType.AROUND_TIMEOUT))
+ {
+ try
+ {
+ InvocationContextImpl impl = new InvocationContextImpl(null, context.getTarget(), null, null,
+ InterceptorUtil.getInterceptorMethods(this.contextual.getInterceptorStack(), InterceptorType.AROUND_TIMEOUT), InterceptorType.AROUND_TIMEOUT);
+ impl.setCreationalContext(this.cc);
+ impl.setEJBInvocationContext(context);
+ impl.setCcKey((Object)this.ccKey);
+
+ rv = impl.proceed(); //run OWB interceptors and underlying EJBcontext.proceed()
+ }
+ catch (Exception e)
+ {
+ logger.error(OWBLogConst.ERROR_0008, e, "@AroundTimeout.");
+ throw new RuntimeException(e);
+ }
+ }
+ else
+ {
+ rv = context.proceed(); // no 299 interceptors
+ }
+
+ return rv;
+ }
+
+
/**
* PrePassivate callback