I've been doing some code reviews of CXF and noticed a lot of thread unsafe uses of Exchange. Most of the interceptors assume the Exchange.get and Exchange.put calls are safe, but they are only backed by HashMap without synchronization. For the HttpConduit, that's safe because the request and response are generally handled on the same thread. However with other transports, that wouldn't be the case. It's possible that the request thread is still in the In phase chain processing interceptors, after Phase.SEND, before the Conduit or Destination begin handling the response, in a different thread. That could lead to Exchange.put calls corrupting the backing map or any Exchange.get calls. Message.get/.put suffer a similar problem, but are less likely to be used by multiple threads.
Should the StringMapImpl be backed by something that is thread safe (ConcurrentHashMap, etc), or am I misunderstanding some of the threading somewhere?
