Hello.

The threading fix committed to the Axiom DOM by Ruchith Fernando [1]
seems to not resolve the problem.

1. Imagine two threads enter the method setDOOMRequired(true).
The faster one calls System.setProperty(systemKey,
DocumentBuilderFactoryImpl.class.getName()).
Then the slower thread executes originalDocumentBuilderFactory =
DocumentBuilderFactory.newInstance(). This time the
originalDocumentBuilderFactory gets lost, because it becomes
org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl.

2. Another way to break the application for two threads is to call
setDOOMRequired(false) by one thread while the other is in
DOOMRequired state and is going to get a DocumentBuilderFactory. The
later thread will get original Document Builder (probably Xerces)
rather than DOOM because the system wide property is reset by the
first thread.

I do not know a good fix for the problem other than thread synchronization.
Another way (a bit clumsy) I see is to remove system property and set
up a thread context class loader which overrides Jar Service Provider
Mechanism via getResourceAsStream for
META-INF/services/javax.xml.parsers.DocumentBuilderFactory. This class
loader should return
org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl in
DOOMRequired state and delegate to the parent class loader in
non-DOOMRequired state.

[1] http://marc.theaimsgroup.com/?l=axis-user&m=116237867100030&w=2

--
Yevgeny Rouban
INTEL Middleware Products Division

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to