private void stopAll(List<ComponentProperties> componentProperties) { List<ComponentProperties> componentsToStop = new ArrayList<>(componentProperties); Collections.reverse(componentsToStop); componentsToStop.stream().forEach(c -> { try { Method main = null; main = c.getMainClass().getMethod("stop"); main.invoke(c.getInstance()); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { log.error("unable to reflect main", e); } }); }
return new ComponentProperties(o, mainClass); } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { log.error("unable to reflect main", e);
private void printBanner() { HadoopUtils.INSTANCE.printBanner(System.out); componentProperties.stream().forEach(c -> { Object name = null; Object prop = null; if (c != null) { try { Method main = c.getMainClass().getMethod("getName"); name = main.invoke(c.getInstance()); main = c.getMainClass().getMethod("getProperties"); prop = main.invoke(c.getInstance()); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { log.error("unable to reflect main", e); } HadoopUtils.printColorLine(System.out, GREEN, "\t\t - " + name + " " + prop); } }); System.out.println(); }