Class JobProcessFactory

java.lang.Object
uk.ac.manchester.spinnaker.nmpiexec.jobprocess.JobProcessFactory

public class JobProcessFactory extends Object
A factory for creating JobProcess instances given a JobParameters instance.
  • Constructor Details

    • JobProcessFactory

      public JobProcessFactory(ThreadGroup threadGroup)
      Create a factory.
      Parameters:
      threadGroup - The thread group for the factory. All threads created by the factory will be within this group.
    • JobProcessFactory

      public JobProcessFactory(String threadGroupName)
      Create a factory.
      Parameters:
      threadGroupName - The name of the thread group for the factory. All threads created by the factory will be within this group.
  • Method Details

    • addMapping

      public <P extends JobParameters> void addMapping(Class<P> parameterType, JobProcessFactory.ProcessSupplier<P> processSupplier)
      Adds a new type mapping.
      Type Parameters:
      P - The type of parameters that this mapping will handle.
      Parameters:
      parameterType - The job parameter type
      processSupplier - The job process supplier
    • getParameterTypes

      public Collection<Class<? extends JobParameters>> getParameterTypes()
      Get the types of parameters supported.
      Returns:
      A collection of types of parameters
    • createProcess

      public <P extends JobParameters> JobProcess<P> createProcess(P parameters)
      Creates a JobProcess given a JobParameters instance.
      Type Parameters:
      P - The type of the job parameters.
      Parameters:
      parameters - The parameters of the job
      Returns:
      A JobProcess matching the parameters
      Throws:
      IllegalArgumentException - If the type of the job parameters is unexpected.