[jbossws-dev] [Design of JBoss Web Services] - Re: Review of fix for JBWS-2304

richard.opalka@jboss.com do-not-reply at jboss.com
Sat Sep 27 15:40:20 EDT 2008


"darran.lofthouse at jboss.com" wrote : Overall I think the mechanism to cache the Document and DocumentBuilder should be re-factored to possibly associate it with the MessageContext and the message itself so that it does not need to be in it's own ThreadLocal with a potential for leaks - however I am not sure if such a bug change would be suitable at the moment.
  | 
  | Anyway I just wanted to see if you have any additional thoughts on this fix before I commit.
  | 
Hi Darran,

   to be honest I don't like our current DOMUtils ThreadLocals capability. ThreadLocals  holding thread-specific fields should only be used when there is no other good option available. The following are top two reasons to avoid ThreadLocals:

 The use of thread-specific variables tends to hide parameters that influence behaviour and can make it harder to check for errors or leakage. In this sense, thread-specific variables present the same, although less extreme, traceability problems as static global variables.
  Use of thread-specific variables can detract from reusability by increasing code dependencies.

   In other words if you will refactor our DOMUtils and will remove ThreadLocals dependent code, I will really like your solution ;)

Richard

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179207#4179207

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4179207



More information about the jbossws-dev mailing list