Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » ThreadContext.get() / put()
ThreadContext.get() / put() [message #1053680] Tue, 07 May 2013 08:39 Go to next message
Ralph Steiner is currently offline Ralph SteinerFriend
Messages: 3
Registered: April 2010
Junior Member
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?
Re: ThreadContext.get() / put() [message #1058448 is a reply to message #1053680] Tue, 14 May 2013 07:19 Go to previous messageGo to next message
Ralph Steiner is currently offline Ralph SteinerFriend
Messages: 3
Registered: April 2010
Junior Member
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.
Re: ThreadContext.get() / put() [message #1058481 is a reply to message #1058448] Tue, 14 May 2013 10:43 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Thanks for your feedback.
Previous Topic:Derby DB with ClientDriver
Next Topic:JavaDoc for Scout ?
Goto Forum:
  


Current Time: Tue Apr 16 10:33:26 GMT 2024

Powered by FUDForum. Page generated in 0.54421 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top