Package com.saxonica.ee.parallel
Class ThreadManagerEE
- java.lang.Object
-
- net.sf.saxon.expr.XPathContextMajor.ThreadManager
-
- com.saxonica.ee.parallel.ThreadManagerEE
-
public class ThreadManagerEE extends XPathContextMajor.ThreadManager
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 Constructor Description ThreadManagerEE(EnterpriseConfiguration config)
Create a thread manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CountingCompletionService<Outcome<java.lang.Boolean>>
getCompletionService()
Get the ExecutorService (so that new work can be submitted)void
waitForChildThreads()
Wait for child threads started under the control of this context to finish.
-
-
-
Constructor Detail
-
ThreadManagerEE
public ThreadManagerEE(EnterpriseConfiguration config)
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 Detail
-
getCompletionService
public CountingCompletionService<Outcome<java.lang.Boolean>> getCompletionService()
Get the ExecutorService (so that new work can be submitted)- Returns:
- the ExecutorService
-
waitForChildThreads
public void waitForChildThreads() throws XPathException
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.
-
-