private Map<Optional<Executor>, List<ExecutableFlow>> getFlowToExecutorMap() { final HashMap<Optional<Executor>, List<ExecutableFlow>> exFlowMap = new HashMap<>(); for (final Pair<ExecutionReference, ExecutableFlow> runningFlow : this.runningExecutions.get() .values()) { final ExecutionReference ref = runningFlow.getFirst(); final ExecutableFlow flow = runningFlow.getSecond(); final Optional<Executor> executor = ref.getExecutor(); // We can set the next check time to prevent the checking of certain // flows. if (ref.getNextCheckTime() >= DateTime.now().getMillis()) { continue; } List<ExecutableFlow> flows = exFlowMap.get(executor); if (flows == null) { flows = new ArrayList<>(); exFlowMap.put(executor, flows); } flows.add(flow); } return exFlowMap; }
private Map<Optional<Executor>, List<ExecutableFlow>> getFlowToExecutorMap() { final HashMap<Optional<Executor>, List<ExecutableFlow>> exFlowMap = new HashMap<>(); for (final Pair<ExecutionReference, ExecutableFlow> runningFlow : this.runningFlows .values()) { final ExecutionReference ref = runningFlow.getFirst(); final ExecutableFlow flow = runningFlow.getSecond(); final Optional<Executor> executor = ref.getExecutor(); // We can set the next check time to prevent the checking of certain // flows. if (ref.getNextCheckTime() >= System.currentTimeMillis()) { continue; } List<ExecutableFlow> flows = exFlowMap.get(executor); if (flows == null) { flows = new ArrayList<>(); exFlowMap.put(executor, flows); } flows.add(flow); } return exFlowMap; }
private Map<ConnectionInfo, List<ExecutableFlow>> getFlowToExecutorMap() { HashMap<ConnectionInfo, List<ExecutableFlow>> exFlowMap = new HashMap<ConnectionInfo, List<ExecutableFlow>>(); ConnectionInfo lastPort = new ConnectionInfo(executorHost, executorPort); for (Pair<ExecutionReference, ExecutableFlow> runningFlow: runningFlows.values()) { ExecutionReference ref = runningFlow.getFirst(); ExecutableFlow flow = runningFlow.getSecond(); // We can set the next check time to prevent the checking of certain flows. if (ref.getNextCheckTime() >= System.currentTimeMillis()) { continue; } // Just a silly way to reduce object creation construction of objects since it's most likely that the values will be the same. if (!lastPort.isEqual(ref.getHost(), ref.getPort())) { lastPort = new ConnectionInfo(ref.getHost(), ref.getPort()); } List<ExecutableFlow> flows = exFlowMap.get(lastPort); if (flows == null) { flows = new ArrayList<ExecutableFlow>(); exFlowMap.put(lastPort, flows); } flows.add(flow); } return exFlowMap; }