Yes, the thread local approach is potentially overly coarse. The use case you mentioned would only work if both SFSBs use the same cache.  If however, a clustered SFSB invokes an SLSB, which itself creates a SFSB that is not passivationCapable - the user would encounter an exception at runtime, since this configuration is disallowed in both the existing implementation and the implementation in this PR, even though it is technically a valid use case.

The underlying issue is with the org.jboss.as.ejb3.cache.Cache interface itself.  The Cache.create(...) method needs to supply the appropriate context as a parameter.  However, this change is out of the scope of this PR.