Map<String, IParam> pluginParamsMap) throws TimeoutException,
ExecutionException, InterruptedException {
for (JobPluginConf jobPluginConf : jobPluginList) {
String writerID = jobPluginConf.getId();
IParam jobParams = jobPluginConf.getPluginParam();
writerToJobParamsMap.put(writerID, jobParams);
IParam pluginParams = pluginParamsMap.get(jobPluginConf
.getPluginName());
jobParams.putValue(AbstractPlugin.PLUGINID, writerID);
String writerPath = pluginParams.getValue(PluginConfParamKey.PATH);
String writerPeripheryClassName = pluginParams
.getValue(PluginConfParamKey.PERIPHERY_CLASS_NAME);
IWriterPeriphery writerPeriphery = null;
if (StringUtils.isEmpty(writerPeripheryClassName)) {
writerPeriphery = new DefaultWriterPeriphery();
} else {
writerPeriphery = ReflectionUtil
.createInstanceByDefaultConstructor(
writerPeripheryClassName,
IWriterPeriphery.class,
JarLoader.getInstance(writerPath));
}
writerPeripheryMap.put(writerID, writerPeriphery);
String splitterClassName = pluginParams
.getValue(PluginConfParamKey.SPLITTER_CLASS_NAME);
ISplitter splitter = null;
if (StringUtils.isEmpty(splitterClassName)) {
splitter = new DefaultSplitter();
} else {
splitter = ReflectionUtil.createInstanceByDefaultConstructor(
splitterClassName, ISplitter.class,
JarLoader.getInstance(writerPath));
}
WritePrepareCallable<List<IParam>> writerCallable = new WritePrepareCallable<List<IParam>>();
writerCallable.writerPeriphery = writerPeriphery;
writerCallable.jobParams = jobParams;
runWithTimeout(new FutureTask<List<IParam>>(writerCallable));
splitter.init(jobParams);
WriteSplitCallable<List<IParam>> splitCallable = new WriteSplitCallable<List<IParam>>();
splitCallable.splitter = splitter;
List<IParam> splittedParam = (List<IParam>) runWithTimeout(new FutureTask<List<IParam>>(
splitCallable));
int concurrency = getConcurrency(jobParams, pluginParams);
String writeClassName = pluginParams
.getValue(PluginConfParamKey.PLUGIN_CLASS_NAME);
ExecutorService writerPool = createThreadPool(concurrency);
writerPoolMap.put(writerID, writerPool);
List<Future<Integer>> resultList = new ArrayList<Future<Integer>>();