tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: AW: Store data in SessionContext
Date Tue, 17 Jun 2008 18:38:59 GMT
On Jun 17, 2008, at 6:15 AM, <> <

 > wrote:

> Hi David, hi Dain,
> I have tried to use the  
> javax.interceptor.InvocationContext.getContextData() approach.  
> Unfortunately it did not works, because The InvocationContext  
> differs for me. I have two Interceptor, one is picking up the  
> necessary return value for me the other should rollback it. The  
> rollback interceptor intercepts different methods, so the invocation  
> context is different and the contained map also.
> Now my choosen approach is to use a static ThreadLocal in one  
> interceptor.
> Question regarding this:
> Why are static fields allowed in stateless beans? In my EJB 3.0 spec  
> it is not allowed.
> Are static fields also allowed in interceptors like I want to do it?

According to the spec they are not allowed, but it is an unenforceable  
and in my opinion a stupid restriction.  To my knowledge no vendor  
actually stops you from using static fields.  If you really really  
want to be spec compliant, put the actual field in another class.   
This is legal since EJBs are allowed to use other Java classes.


View raw message