public class ParallelJobExecutor extends Object implements JobExecutor
ParallelJobExecutor
which use multiple threads for each resource.JobExecutor.Executing
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_RESOURCE_ID
The default resource name.
|
static String |
KEY_PARALLEL_PREFIX
The key prefix of multiplexity configuration each resources.
|
Constructor and Description |
---|
ParallelJobExecutor(int defaultResuorce,
Map<String,Integer> threadConfig)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
static ParallelJobExecutor |
extract(String servicePrefix,
Map<String,String> configuration,
VariableResolver variables)
Extracts multiplexity profiles from configuration and returns a related executor.
|
JobExecutor.Executing |
submit(ExecutionMonitor monitor,
ExecutionContext context,
Job job,
BlockingQueue<JobExecutor.Executing> doneQueue)
Submits a job.
|
public static final String KEY_PARALLEL_PREFIX
public static final String DEFAULT_RESOURCE_ID
public ParallelJobExecutor(int defaultResuorce, Map<String,Integer> threadConfig)
defaultResuorce
- default resource multiplexitythreadConfig
- each resource multiplexityIllegalArgumentException
- if some parameters were null
public static ParallelJobExecutor extract(String servicePrefix, Map<String,String> configuration, VariableResolver variables)
This operation extracts following entries from configuration
:
Profiles must be contain parallel.default
.
servicePrefix
- prefix of configuration keysconfiguration
- target configurationvariables
- variable resolverIllegalArgumentException
- if configuration is invalidpublic JobExecutor.Executing submit(ExecutionMonitor monitor, ExecutionContext context, Job job, BlockingQueue<JobExecutor.Executing> doneQueue) throws InterruptedException, IOException
JobExecutor
submit
in interface JobExecutor
monitor
- an execution monitorcontext
- current contextjob
- target jobdoneQueue
- the queue where the done tasks are putInterruptedException
- if submittion is interruptedIOException
- if failed to submit the target jobCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.