InterviewSolution
| 1. |
Is Jdom Thread Safe? |
|
Answer» The core API is intentionally not thread safe. In other words, there are no synchronized blocks within org.jdom. This decision makes sense because we expect the primary JDOM use cases to be:
The use case where a "Single thread reads an XML stream into JDOM and exposes it to multiple THREADS to MODIFY its contents" is fairly rare. In that case, JDOM can still be made thread safe but the programmer SIMPLY has to PERFORM their own synchronization, perhaps as synchronizing on the DOCUMENT instance. On the other hand, there are certain functions that require 'operational' parts of JDOM to be thread safe:
The core API is intentionally not thread safe. In other words, there are no synchronized blocks within org.jdom. This decision makes sense because we expect the primary JDOM use cases to be: The use case where a "Single thread reads an XML stream into JDOM and exposes it to multiple threads to modify its contents" is fairly rare. In that case, JDOM can still be made thread safe but the programmer simply has to perform their own synchronization, perhaps as synchronizing on the Document instance. On the other hand, there are certain functions that require 'operational' parts of JDOM to be thread safe: |
|