JBoss Community

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

created by Christian Groove in EJB3 - View the full discussion

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

Start a new discussion in EJB3 at Community