Class MultithreadingFactory

java.lang.Object
com.saxonica.ee.config.MultithreadingFactory

public class MultithreadingFactory extends Object
This class defines a number of methods that support the use of multi-threading in Saxon. By subclassing MultithreadingFactory and registering the subclass with the configuration using the method EnterpriseConfiguration.setMultithreadingFactory(MultithreadingFactory), it is possible to customize Saxon's multithreading behavior.
  • Constructor Details

    • MultithreadingFactory

      public MultithreadingFactory(EnterpriseConfiguration config)
      Create a MultithreadingFactory
      Parameters:
      config - the Saxon Configuration (must be a Saxon-EE configuration)
  • Method Details

    • makeMultithreadedItemMappingIterator

      public SequenceIterator makeMultithreadedItemMappingIterator(SequenceIterator base, ItemMappingFunction action) throws XPathException
      Get an item mapping iterator suitable for multi-threaded execution. The returned iterator delivers the result of applying a mapping function to each item in an input sequence. The result sequence respects the ordering of the input sequence, but the order of processing (the timing of the executions of the mapping function) is implementation-defined.
      Parameters:
      base - iterator over the input sequence
      action - mapping function to be applied to each item in the input sequence.
      Returns:
      an iterator over the result sequence
      Throws:
      XPathException
    • makeThreadManager

      public XPathContextMajor.ThreadManager makeThreadManager()
      Make a ThreadManager for asynchronous xsl:result-document instructions
      Returns:
      a new ThreadManager (or null in the case of Saxon-HE, or if multithreading is disabled)
    • makeExecutorService

      public ExecutorService makeExecutorService(int threads)
      Make an ExecutorService for a given number of threads
      Parameters:
      threads - the required number of threads
    • makeThread

      public Thread makeThread(Runnable runnable)
      Make a new Thread
      Parameters:
      runnable - the Runnable to be executed by the thread