Multithreading with the Java API
When using the Java API with multiple threads, you must follow the guidelines in this document to help you produce reliable, bug-free programs.
When using multithreading with the Java API, do not access a DocumentComparator, PipelinedComparator or DataComparator instance nor their configuration objects from multiple threads at the same time.
If you are using input multithreading (which you are by default unless you have explicitly turned it off), follow the guidelines in the input multithreading guide.
Guidelines for multithreading with the Java API
In the following list of guidelines, comparator refers to either DocumentComparator, PipelinedComparator or DataComparator.
-
You must not share a net.sf.saxon.s9api.Processor between multiple comparator objects.
-
You must not interact with a comparator instance from multiple threads simultaneously. This includes any comparator configuration objects such as those from com.deltaxml.core.config.
-
You must not share pipeline configuration objects between comparators or interact with them from multiple threads simultaneously.
-
Pipeline configuration objects are FilterStep, FilterChain and FilterStepHelper
-
This means that if you wish to have the same input pipeline for multiple comparators, you must create two distinct copies of the input pipeline that do not reference each other.
-
-
If you use the underlying Saxon API, you must follow Saxon’s rules for multithreading which are detailed throughout their documentation.
-
If you share Saxon objects across multiple comparators and then run those comparators from multiple threads simultaneously, any behaviour is undefined.
Currently comparator instances may use live references to comparator configuration and pipeline configuration objects. Therefore, altering the state of one of those objects which is shared between comparators may lead to undefined behaviour if done concurrently.