public void close() { // sync SampleCollector.class and then this.sampleHandlers synchronized (SampleCollector.class) { synchronized (this.sampleHandlers) { if (logger.isTraceEnabled(LogMarker.STATISTICS_VERBOSE)) { logger.trace(LogMarker.STATISTICS_VERBOSE, "SampleCollector#close"); } try { StatArchiveHandler handler = this.statArchiveHandler; if (handler != null) { handler.close(); } } catch (GemFireException ignore) { logger.warn(LogMarker.STATISTICS_MARKER, "Statistic archiver shutdown failed because: {}", ignore.getMessage()); } StatMonitorHandler handler = this.statMonitorHandler; if (handler != null) { handler.close(); } } if (instance == this) { instance = null; } } }