List<ListenableFuture<Void>> droneResults = Lists.newArrayList();
for(final Drone drone : ImmutableList.copyOf(mDrones)) {
droneResults.add(mExecutor.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
TestBatch batch = null;
try {
do {
batch = parallelWorkQueue.poll(mNumPollSeconds, TimeUnit.SECONDS);
if(mShutdown) {
mLogger.warn("Shutting down host " + mHost.getName());
return null;
}
if(batch != null) {
if(!executeTestBatch(drone, batch, failedTestResults)) {
failedTestResults.add(batch);
}
}
} while(!mShutdown && !parallelWorkQueue.isEmpty());
} catch(AbortDroneException ex) {
mDrones.remove(drone); // return value not checked due to concurrent access
mLogger.error("Aborting drone during parallel execution", ex);
if(batch != null) {
Preconditions.checkState(parallelWorkQueue.add(batch),
"Could not add batch to parallel queue " + batch);
}
}
return null;
}
}));
}
if(mShutdown) {
mLogger.warn("Shutting down host " + mHost.getName());
return;
}
Futures.allAsList(droneResults).get();
mLogger.info("Starting isolated execution on " + mHost.getName());
for(Drone drone : ImmutableList.copyOf(mDrones)) {
TestBatch batch = null;
try {
do {
batch = isolatedWorkQueue.poll(mNumPollSeconds, TimeUnit.SECONDS);
if(batch != null) {
if(!executeTestBatch(drone, batch, failedTestResults)) {