LOG.debug("Waiting for " + mDone.getCount() + " processor(s)...");
mRemoteProcesses = new HashSet<GatewayProcess>();
mLocalProcesses = new HashSet<DISPELGraphExecutor>();
for (Entry<GatewayLocation, Graph> entry : graphs.entrySet())
{
GatewayLocation location = entry.getKey();
if (location instanceof LocalGateway)
{
processLocally(context, entry.getValue());
}
else
{
String dispel = GraphConverter.convertToDISPEL(entry.getValue());
LOG.debug("Remote DISPEL:\n" + dispel);
Gateway gateway = null;
GatewayProcess process = null;
try
{
gateway = GatewayFactory.get(location.getAddress());
process = gateway.submit(dispel);
}
catch (URISyntaxException e)
{
LOG.error("Remote gateway address is invalid: " +
location.getAddress());
throw new InitialisationFailedException();
}
catch (ServerException e)
{
LOG.error("Problems with remote gateway", e);