I am trying to bring a legacy jar file into an EJB. The legacy jar file manages a Java Singleton using the ThreadLocal pattern -- that is each thread appears to be able to use a POJO Singleton because the real state is held in a ThreadLocal.
Now I want to use this jar in an EJB and it is failing. It appears the WebLogic container is switching threads in the middle of a session, throwing the ThreadLocal off.
Is there some equivalent pattern in EJB's that I can use? Is there some statically accessible context data where I can store some information?
What do you mean by "session" exactly? Its a pretty non-specific term that can already translate to several different things in the context of a JEE environment.
You could use something like EHCache as an alternative to ThreadLocal, which has a pretty easy programming interface.