Class JobProcessFactory
java.lang.Object
uk.ac.manchester.spinnaker.nmpiexec.jobprocess.JobProcessFactory
A factory for creating
JobProcess instances given a
JobParameters instance.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA version ofSupplierthat builds a job process. -
Constructor Summary
ConstructorsConstructorDescriptionJobProcessFactory(String threadGroupName) Create a factory.JobProcessFactory(ThreadGroup threadGroup) Create a factory. -
Method Summary
Modifier and TypeMethodDescription<P extends JobParameters>
voidaddMapping(Class<P> parameterType, JobProcessFactory.ProcessSupplier<P> processSupplier) Adds a new type mapping.<P extends JobParameters>
JobProcess<P>createProcess(P parameters) Creates aJobProcessgiven aJobParametersinstance.Collection<Class<? extends JobParameters>>Get the types of parameters supported.
-
Constructor Details
-
JobProcessFactory
Create a factory.- Parameters:
threadGroup- The thread group for the factory. All threads created by the factory will be within this group.
-
JobProcessFactory
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 typeprocessSupplier- The job process supplier
-
getParameterTypes
Get the types of parameters supported.- Returns:
- A collection of types of parameters
-
createProcess
Creates aJobProcessgiven aJobParametersinstance.- 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.
-