private Map < Optional < Executor > , List < ExecutableFlow > > getFlowToExecutorMap ( ) { final HashMap < Optional < Executor > , List < ExecutableFlow > > exFlowMap = new HashMap <> ( ) ; try { for ( final Pair < ExecutionReference , ExecutableFlow > runningFlow : this . executorLoader . fetchActiveFlows ( ) . values ( ) ) { final Optional < Executor > executor = runningFlow . getFirst ( ) . getExecutor ( ) ; List < ExecutableFlow > flows = exFlowMap . get ( executor ) ; if ( flows == null ) { flows = new ArrayList <> ( ) ; exFlowMap . put ( executor , flows ) ; } flows . add ( runningFlow . getSecond ( ) ) ; } } catch ( final ExecutorManagerException e ) { logger . error ( "Failed to get flow to executor map" ) ; } return exFlowMap ; }
Groups Executable flow by Executors to reduce number of REST calls .