}
@Override
public DistStageAck executeOnSlave() {
// TODO: customize stats
Statistics stats = new DefaultStatistics(new DefaultOperationStats());
CountDownLatch startLatch = new CountDownLatch(1);
ArrayList<IteratingStressor> stressors = new ArrayList<IteratingStressor>(numThreads);
try {
for (int i = 0; i < numThreads; ++i) {
Iterable.Filter filter = null;
Iterable.Converter converter = null;
try {
if (filterClass != null) {
filter = Utils.instantiateAndInit(slaveState.getClassLoader(), filterClass, filterParam);
}
if (converterClass != null) {
converter = Utils.instantiateAndInit(slaveState.getClassLoader(), converterClass, converterParam);
}
} catch (Exception e) {
terminate(stressors);
return errorResponse("Failed to create the filter or converter", e);
}
IteratingStressor stressor = new IteratingStressor(i, iterable, containerName, filter, converter,
maxNextFailures, numLoops, startLatch, stats.newInstance());
stressors.add(stressor);
stressor.start();
}
} finally {
startLatch.countDown();