Search code examples
javaxmlthread-safetyxom

XOM: is Builder.build() thread safe?


Is Builder.build() thread safe? I couldn't find any info in XOM Javadoc.


Solution

  • Builder doesn't tell us that one of the builder methods is thread-safe and we have no reason to assume it: the methods are not synchronized (look at the code) and the class uses the first available parser and delegates the work.

    So we should avoid sharing one instance of nu.xom.Builder between different threads.