@Override public synchronized void shutdown() throws IllegalStateException { if (!_state.isRunning()) throw new IllegalStateException( "Registration (" + _id + ") is not in running state to be shutdown. Current state :" + _state); _sourcesConnection.unregisterMbeans(); _sourcesConnection.stop(); _status.shutdown(); _state = RegistrationState.SHUTDOWN; // remove this registration stats from client stats Collector list. _client.getBootstrapEventsStats().removeStatsCollector(_id.getId()); _client.getInBoundStatsCollectors().removeStatsCollector(_id.getId()); _client.getRelayConsumerStatsCollectors().removeStatsCollector(_id.getId()); _client.getBootstrapConsumerStatsCollectors().removeStatsCollector(_id.getId()); _client.getUnifiedClientStatsCollectors().removeStatsCollector(_id.getId()); }