@Test public void testCall() throws ExecutionException, InterruptedException { LongRunningProcess proc = new LongRunningProcess(UUID.randomUUID(), () -> {}); LongRunningProcessStartTask task = createTask(proc); List<UUID> procIds = task.call(); assertEquals(1, procIds.size()); UUID procId = procIds.get(0); assertNotNull(metadataStorage.get(procId)); Future<?> fut = metadataStorage.get(procId); fut.get(); assertEquals(true, fut.isDone()); }
@Override public List<UUID> call() { ArrayList<UUID> res = new ArrayList<>(); try { for (LongRunningProcess proc : processes) { Future<?> fut = runTask(proc.getTask()); UUID procId = saveProcMetadata(fut); res.add(procId); } } catch (Exception e) { stopAllProcessesAndClearMetadata(res); throw e; } return res; }
LongRunningProcessStartTask extends LongRunningProcessTask<List<UUID>> { @Override public List<UUID> call() { ArrayList<UUID> res = new ArrayList<>(); try { for (LongRunningProcess proc : processes) { Future<?> fut = runTask(proc.getTask()); UUID procId = saveProcMetadata(fut); res.add(procId); } } catch (Exception e) { stopAllProcessesAndClearMetadata(res); throw e; } return res; } }
LongRunningProcessStartTask extends LongRunningProcessTask<List<UUID>> { @Override public List<UUID> call() { ArrayList<UUID> res = new ArrayList<>(); try { for (LongRunningProcess proc : processes) { Future<?> fut = runTask(proc.getTask()); UUID procId = saveProcMetadata(fut); res.add(procId); } } catch (Exception e) { stopAllProcessesAndClearMetadata(res); throw e; } return res; } LongRunningProcessStartTask(List<LongRunningProcess> processes); }
LongRunningProcessStartTask extends LongRunningProcessTask<List<UUID>> { @Override public List<UUID> call() { ArrayList<UUID> res = new ArrayList<>(); try { for (LongRunningProcess proc : processes) { Future<?> fut = runTask(proc.getTask()); UUID procId = saveProcMetadata(fut); res.add(procId); } } catch (Exception e) { stopAllProcessesAndClearMetadata(res); throw e; } return res; } LongRunningProcessStartTask(List<LongRunningProcess> processes); @Override List<UUID> call(); }
LongRunningProcessStartTask extends LongRunningProcessTask<List<UUID>> { @Override public List<UUID> call() { ArrayList<UUID> res = new ArrayList<>(); try { for (LongRunningProcess proc : processes) { Future<?> fut = runTask(proc.getTask()); UUID procId = saveProcMetadata(fut); res.add(procId); } } catch (Exception e) { stopAllProcessesAndClearMetadata(res); throw e; } return res; } LongRunningProcessStartTask(List<LongRunningProcess> processes); @Override List<UUID> call();  }