Package com.saxonica.ee.parallel
Class ThreadManagerEE
java.lang.Object
net.sf.saxon.expr.XPathContextMajor.ThreadManager
com.saxonica.ee.parallel.ThreadManagerEE
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the ExecutorService (so that new work can be submitted)void
Wait for child threads started under the control of this context to finish.
-
Constructor Details
-
ThreadManagerEE
Create a thread manager. This initializes an ExecutorService using a fixed thread pool, the number of threads being determined (by default) by the number of available CPUs
-
-
Method Details
-
getCompletionService
Get the ExecutorService (so that new work can be submitted)- Returns:
- the ExecutorService
-
waitForChildThreads
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.- Specified by:
waitForChildThreads
in classXPathContextMajor.ThreadManager
- Throws:
XPathException
- if any of the child threads have failed with a dynamic error.
-