[javaee-spec users] ThreadLocal usage in ejb environment

From: <>
Date: Thu, 12 Jun 2014 12:17:58 +0000 (UTC)


I opened an issue in Jira to clarify ThreadLocal usage.

I'm not sure what the best canal is, maybe it's best to describe it
here first.

Anyway, here it goes:

My interpretation from EJB3.2/§16.2.2 is that you can't have
ThreadLocal's, the main reason being that thread management is not
portable across server implementations. As we know, there are no
guarantees on threads, so it's not reliable at best, and probably

From this, ThreadLocal usage can't be portable. Introduction of §16.2.2
says this:

"This section describes the programming restrictions that a Bean
Provider must follow to ensure that the
enterprise bean is portable and can be deployed in any compliant EJB
container. The restrictions apply
to the implementation of the business methods. Section 16.3, which
describes the container's view of
these restrictions, defines the programming environment that all EJB
containers must provide."

So, shouldn't there be some specific paragraph on ThreadLocal, or a
more generic which would cite ThreadLocal usage as an example?

What do you think?
Best regards,
Yannick Majoros