Source:
<code>private List<Map<String, List<String>>> executeVarQuery(Map<String, Object> vars, String varName) throws LDAPException { List<Map<String, List<String>>> ret = new ArrayList<>(); List<String> queryVars = new ArrayList<>(); for (String var : vars.keySet()) { if (var.startsWith(varName)) { queryVars.add(var); } } if (queryVars.size() > 0) { try { ExecutorService executor = Executors.newFixedThreadPool(queryVars.size()); List<Future<List<Map<String, List<String>>>>> list = new ArrayList<>(); for (String var : queryVars) { log.debug("Resolving query var '{}'", var); Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { Callable<List<Map<String, List<String>>>> searchExecute = framework.new SearchExecute(instance, 0); Future<List<Map<String, List<String>>>> submit = executor.submit(searchExecute); list.add(submit); } } for (Future<List<Map<String, List<String>>>> future : list) { try { ret.addAll(future.get()); } catch (InterruptedException | ExecutionException e) { <START> log.error("Failed to execute search: {}", e.getMessage()); <END> log.debug("Exception", e); } } executor.shutdown(); } finally { for (String var : queryVars) { Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { vars.remove(var); try { framework.searchClose(instance); } catch (Exception e) { log.error("Cannot close search of var '{}'", var); log.debug("Cannot close search of var '{}', search: {}", var, instance); log.debug("Exception", e); } } } } } return ret; }</code><technical_language>Hmm, break processing return error? If fail submit search for server, return correct results ..</technical_language>

Target:
private List<Map<String, List<String>>> executeVarQuery(Map<String, Object> vars, String varName) throws LDAPException { List<Map<String, List<String>>> ret = new ArrayList<>(); List<String> queryVars = new ArrayList<>(); for (String var : vars.keySet()) { if (var.startsWith(varName)) { queryVars.add(var); } } if (queryVars.size() > 0) { try { ExecutorService executor = Executors.newFixedThreadPool(queryVars.size()); List<Future<List<Map<String, List<String>>>>> list = new ArrayList<>(); for (String var : queryVars) { log.debug("Resolving query var '{}'", var); Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { Callable<List<Map<String, List<String>>>> searchExecute = framework.new SearchExecute(instance, 0); Future<List<Map<String, List<String>>>> submit = executor.submit(searchExecute); list.add(submit); } } for (Future<List<Map<String, List<String>>>> future : list) { try { ret.addAll(future.get()); } catch (InterruptedException | ExecutionException e) { log.error("Failed to execute search: {}", e.getMessage()); log.debug("Exception", e); throw new RuntimeException(e); } } executor.shutdown(); } finally { for (String var : queryVars) { Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { vars.remove(var); try { framework.searchClose(instance); } catch (Exception e) { log.error("Cannot close search of var '{}'", var); log.debug("Cannot close search of var '{}', search: {}", var, instance); log.debug("Exception", e); } } } } } return ret; }