The ThreadManager is used to manage asynchronous execution of xsl:result-document instructions in Saxon-EE.
It holds an ExecutorService which manages the pool of threads, and allows an exception to be notified if
any of the asynchronous threads fails with a run-time error. A ThreadManager is created when an XSLT
transformation starts, and is shut down when it ends, which forces the main thread to wait until all
asynchronous threads have finished. Executing a try/catch creates a new ThreadManager on the context stack,
which is used to manage all xsl:result-document instructions fired off within that try/catch block; the
xsl:try waits until it is sure that all such threads have completed, and handles the exception appropriately
if any of the threads fails.
Wait for child threads started under the control of this context to finish.
This is called at the end of the (main thread of a) transformation, and also
at the end of the "try" part of a try/catch. The threads affected are those
used to implement xsl:result-document instructions.