Sanjiva, I'm sorry, but it is a valid scenario - the Calls are not thread safe, but in this scenario one Call will not be used in more than one thread at the same time. Threads safe does not mean that one object could be used from different threads at all - just not in the same time. However once you add DocumentBuilder to the thread local storage or map by threads, you make the Call and other objects which store DocBuilder in the local variable, tied to one thread, which makes it not thread safe.
Please look to the patch I have proposed yesterday http://marc.theaimsgroup.com/?l=soap-dev&m=103590623610152&w=2 I believe this solution will be better, since it allow reduce number of DocBuilders created regardless of the user's calls. In multithread environment it could even use less DocumentBuilder that number of threads. Note that if you agree and submit it patch, several other classes needs to be changed, to use pool from all places. Note also that Scott changed class XMLParserUtil already Please also look at the proposed patch http://marc.theaimsgroup.com/?l=soap-dev&m=103582860631002&w=2, were I extend you idea of replacing write of concatenations with a set of writes Thanks, Pavel > -----Original Message----- > From: Sanjiva Weerawarana [mailto:sanjiva@;watson.ibm.com] > Sent: Tuesday, October 29, 2002 6:10 PM > To: Apache SOAP > Subject: about sharing doc builders > > > Pavel Ausianik wrote: > > 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. > > Sorry but this is not a valid scenario for Apache SOAP - the Apache > SOAP APIs are not thread-safe for mutlithreaded execution > like this. So you cannot have a pool of threads and a pool of Call's > and reuse them like this. Things could break horribly if a call > object is reused while another call is in progress. > > If you assume that Calls are not re-used across threads then this > approach works fine right? > > Sanjiva. > > > > -- > To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> > For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org> > -- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>