[jboss-user] [EJB3] - Re: Is it possible to attach an object to active stateless session bean

Christian Groove do-not-reply at jboss.com
Sun Jan 23 05:52:05 EST 2011


Christian Groove [http://community.jboss.org/people/TheGroove] created the discussion

"Re: Is it possible to attach an object to active stateless session bean"

To view the discussion, visit: http://community.jboss.org/message/582554#582554

--------------------------------------------------------------
Salut Ilya,

its much easier:

     @Stateless(....)
     public class MyBean 
     {
       final private static     Logger            LOG = Logger.getLogger(MyBean.class) ;

       public int myMethod(...) 
       {
         final CallCtx    myCtx = new CallCtx() ;
         {
                      myCtx.add(somewaht) ;
               


            callLibAMethod1(.....)


           callLibBMethod2(.....)

           .....
         }
         finally
         {
           myCtx.releaseAll() ;
         }
       }
     }

where: 



     class LibA
     {
       methode1()
       {
*         getRegObject("somewhat")*
         ...
         callsSomeoneElse(...)
       }

     }

     class LibB
 /* similar to LibA */

The simple question is: Will i find some tricky workarouds, that prevents

me of adding a myCtx param to each of the subsequently called methode,
that may be interestes in the registered object.

The registered object is used similar to a JSF-Bean with the exception,
that it is not used outside from myMethod. Therefore, any solution
will be cluster-safe cause the object will be initialized on each new request
is will be not shared across two ejb-method calls.

So, a node globel memory would be OK, where each session/thread
id would identiy a slot in that node-global memory. Anyway i would like
to use a more EJB related sollution, if there exist one.

Another solution woluld be a parameter filed at each of the subsequently
called methode, passing a ctx-memory located at the bean.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/582554#582554]

Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110123/551dc58b/attachment.html 


More information about the jboss-user mailing list