final boolean stopReporter(ReporterFactory reporterFactory) { boolean success = false; try { reporterFactory.stopReporter(); return true; } catch (UnsupportedOperationException e) { logger.debug("ReporterFactory {} does not expose custom startup behavior.", reporterFactory.getClass().getName()); } try { Method m = reporterFactory.getClass().getMethod("stop", (Class<?>[]) null); m.invoke(reporterFactory, (Object[]) null); success = true; } catch (Throwable t) { logger.warn("Unable to stop reporter of type {}", reporterFactory.getClass(), t); } return success; }