I'd like to be able to make the EJBContext visible to all the classes which form my EJB implememtation without explicitly passing it as a parameter.
Can I use a ThreadLocal to do this?
My plan is that I'd assign the context to a ThreadLocal at the start of each EJB member function.
Will this work?
Thanks,
Tom
-
Thread local variables within EJBs? (2 messages)
- Posted by: Tom Davies
- Posted on: April 07 2001 21:34 EDT
Threaded Messages (2)
- Thread local variables within EJBs? by Chuck McCorvey on April 20 2001 15:20 EDT
- what about cross-instance calls? by James S on February 03 2005 17:08 EST
-
Thread local variables within EJBs?[ Go to top ]
- Posted by: Chuck McCorvey
- Posted on: April 20 2001 15:20 EDT
- in response to Tom Davies
There is no prohibition to using ThreadLocal or InheritableThreadLocal within EJB's. The EJB methods must themselves necessarily use conventional Java call semantics to call other methods. As long as you do nothing that could trigger the use of a different thread, you ThreadLocal will be visible. If it is all code you wrote and you don't expect this behavior across invocations of other EJB's, you are fine.
I have done things like this in WebLogic, Orion and JBoss. No problems. -
what about cross-instance calls?[ Go to top ]
- Posted by: James S
- Posted on: February 03 2005 17:08 EST
- in response to Tom Davies
so what do you do if your ejb has to make a remote call (cross-jvm) to another ejb and you want some object passed thru implicitely (not as a method param).
is this even possible and how?
thanks
James