{
LOG.debug("Partitioning graph");
Map<GatewayLocation, Graph> partitions =
partitioner.partition(graph);
DistributedDISPELProcessor processor =
new DistributedDISPELProcessor();
processor.registerRemoteProcessListener(this);
LOG.debug("Initialising distributed processors.");
processor.initialise(context, partitions, mErrors);
allResults.putAll(processor.getResults());
allExternalTransfers.putAll(processor.getExternalTransfers());
allManagedTransfers.putAll(processor.getManagedTransfers());
processors.add(processor);
}
}
catch (InitialisationFailedException e)
{
LOG.error("Caught exception during initialisation.");
updateStatus(ProcessingStatus.INITIALISATION_ERROR);
updateErrors();
updateFinishedAt();
return;
}
updateResourceProperty(Constants.RESOURCE_PROPERTY_RESULTS, allResults);
updateResourceProperty(Constants.RESOURCE_PROPERTY_EXTERNAL_TRANSFERS.getLocalPart(), allExternalTransfers);
LOG.debug("Completed initialisation.");
updateStatus(ProcessingStatus.PROCESSING);
LOG.debug("Starting to process workflows.");
ExecutorService service = Executors.newCachedThreadPool();
CompletionService<Boolean> completion =
new ExecutorCompletionService<Boolean>(service);
try
{
int numTasks = 0;
for (DistributedDISPELProcessor processor : processors)
{
numTasks += processor.process(completion);
}
boolean success = true;
for (int i=0; i<numTasks; i++)
{
if (!completion.take().get())