In a previous scout release we used ThreadContext.get() and ThreadContext.putCustomValue() as a short living cache for EJB references. We now updated our code to scout 3.8 and the methods ThreadContext.get() and ThreadContext.put() are now deprecated. Till now, I have not found a matching replacement for this functionality. A comment on the deprecation annotation is missing.
I tried a mix of using ThreadContext.getHttpServletRequest().setAttribute() in cases where I have servlet request and custom ThreadLocal in cases where a ServerJob is used. Problem is that the ThreadLocal is not transferred to new initiated ServerJobs (without more customizing) and that I have to add at several places code to initiate and destroy the custom ThreadLocal reference.
Because of this I still use the deprecated put and get of ThreadContext.
Where do I place such a short living cache which is used in http requests and SeverJobs?
The solution that I use now is based on using ITransactionMember for the cache and add it to the transaction of the ThreadContext (ThreadContext.getTransaction().registerMember(cache)).
As an example see at the class PreparedStatementCache.
BTW: Using a job property does not work, as the default scheduler (ServerJobs) does not use eclipse jobs.