public void release(@NotNull Target target, @Nullable Parameters configuration) { ArrayList<ProcessHandler> handlers = new ArrayList<ProcessHandler>(); synchronized (myProcMap) { for (Pair<Target, Parameters> pair : myProcMap.keySet()) { if (pair.first == target && (configuration == null || pair.second == configuration)) { ContainerUtil.addIfNotNull(myProcMap.get(pair).handler, handlers); } } } for (ProcessHandler handler : handlers) { handler.destroyProcess(); } fireModificationCountChanged(); }
public void stopAll(boolean wait) { ArrayList<ProcessHandler> allHandlers = new ArrayList<ProcessHandler>(); synchronized (myProcMap) { for (Info o : myProcMap.values()) { ContainerUtil.addIfNotNull(o.handler, allHandlers); } } for (ProcessHandler handler : allHandlers) { handler.destroyProcess(); } if (wait) { for (ProcessHandler handler : allHandlers) { handler.waitFor(); } } }