On Jan 8, 2007, at 4:44 PM, David Blevins wrote:
The work on the Geronimo integration is bringing back some old
memories....
If you look at the top of ThreadContext it's got some stuff in
there to be "pluggable."
public class EnvProps {
...
public final static String THREAD_CONTEXT_IMPL = "org/openejb/
core/ThreadContext/IMPL_CLASS";
...
}
public class ThreadContext implements Cloneable {
...
protected static Class implClass = ThreadContext.class;
...
static {
String className = System.getProperty
(EnvProps.THREAD_CONTEXT_IMPL);
if (className != null) {
...
ClassLoader cl =
ClassLoaderUtil.getContextClassLoader();
implClass = Class.forName(className, true, cl);
...
}
}
I remember this was used in our OpenORB/Tyrex/Castor/OpenJMS
integration (also used by WebObjects) where Tyrex provided the JNDI
and JTA support in conjunction with OpenORB's XA support. There
was an alternate ThreadContext implementation that we plugged in
and took advantage of knowing when changes in the ThreadContext
happened to perform JNDI and TX related work. I remember making
the suggestion to Richard that we should just allow them to plug
*in* to our impl via a listener type interface rather than having
to replace our impl to get those hooks.
Well here we are now facing the same issues with our Geronimo
integration and well... I think I'm going to win that old debate ;-)
Going to make this change in the ThreadContext as well as implement
a generics based map as I did in the Server's CallContext:
http://svn.apache.org/repos/asf/incubator/openejb/trunk/openejb3/
server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/
CallContext.java
So heads up on changes to the ThreadContext. Will let you know
when I'm done. Shouldn't be long.
Ok, I've made some changes in the ThreadContext, but implementing the
full listener type concept in there will perhaps be tricky. Several
things about the ThreadContext can change including the
DeploymentInfo, primary key, and Operation. We could fire an event
at any change at all but that may be expensive.
-David