public synchronized void registerTracker(final ManagementChannelShutdownHandle tracker) { if (!shutdown) { trackers.add(tracker); } else { tracker.shutdown(); } }
public synchronized void prepareShutdown() { shutdown = true; final List<ManagementChannelShutdownHandle> trackers = new ArrayList<>(this.trackers); for (final ManagementChannelShutdownHandle tracker : trackers) { tracker.shutdown(); } }