private void notifyCoreClosedListeners(Throwable th) { synchronized(coreClosedListeners) { for (CoreClosedListener listener : coreClosedListeners) { // SegmentReader uses our instance as its // coreCacheKey: try { listener.onClose(this); } catch (Throwable t) { if (th == null) { th = t; } else { th.addSuppressed(t); } } } IOUtils.reThrowUnchecked(th); } }
void addCoreClosedListener(CoreClosedListener listener) { coreClosedListeners.add(listener); }
void removeCoreClosedListener(CoreClosedListener listener) { coreClosedListeners.remove(listener); }