Sanjiva, Please see what I mean:
> > Another question, what if Call created in one thread, but > then reused in > > other threads (I myself thought about having pool of Call > objects) - in > this > > case the login of getting DocumentBuilder by current thread > will likely > > produce errors, which very difficult to debug. > > No that should work fine. There will not be any relevant state inside > the doc builder - so I believe the 2nd thread will just pick up a > different doc builder and life will go aon jus fine. Imagine we have a pool of Calls, which is not created yet, with 2 instances possible and two threads t1 and t2 I get a Call from pool from thread t1. Since it is not exists, pool create it, t1 use it, creating a DocumentBuilder, return to pool I get a Call from pool from thread 2. Since we have an instance of Call in pool, it will be reused. The operation is not finished yet in the thread t2. I get a Call from pool from thread t1. Since it is not exists, pool create it, again from t1, since DocumentBuilder for t1 exists, it will be reused in new Call. So now we have two separated Calls , with a shared DocumentBuilder - which is definitely not a thread safe. There could be several more scenarios were Call is reused, which will lead to similar problem. Using local thread storage will not help in this case. As for reusing threads I would say it is the same difficulty as reusing Call. If somebody reuse Calls no DocumentBuilder caching by thread is necessary. Although I agree that creating DocumentBuilder takes significal time, I would propose revert this change, since here is a little chances to do this safe for all possible scenarios. Instead I would think about adding an ObjectPool to the project for storing Calls or DocumentBuilder and an example how to use it in user's application. Thanks, Pavel -- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>