@Override protected void shutDown() throws Exception { eventBus.unregister(this); }
@Override protected void shutDown() throws Exception { eventBus.unregister(this); }
public static void unregister(Object bean) { eventBus.unregister(bean); }
@Override public void doStop() { serverEventBus.unregister(this); if (scheduledFuture != null) { scheduledFuture.cancel(true); } }
@Override public void close() throws IOException { _eventBus.unregister(this); }
@Override protected void shutDown() throws Exception { eventBus.unregister(this); metricRegistry.removeMatching((name, metric) -> name.startsWith(name(ConfigurationService.class, "etag-cache"))); } }
@Override public void doStop() { if (consumer != null) { try { consumer.stop(); } catch (IOException e) { LOG.error("Could not stop AMQP consumer.", e); } } eventBus.unregister(this); }
public void unregister(Object object) { logger.log(Level.INFO, "Event bus '" + this.getClass().getSimpleName() + "': Unregistering " + object.getClass().getSimpleName() + " (" + object + ") ..."); eventBus.unregister(object); }
@Override public void stop() { // always unblock the transport when shutting down to avoid deadlock if (currentlyThrottled.get()) { blockLatch.countDown(); } // Call this before unregistering from the eventbus. There might be another call to unregister in doStop() // which is not protected by try/catch. doStop(); if (throttlingAllowed) { try { eventBus.unregister(this); } catch (IllegalArgumentException ignored) { // Ignored. This will be thrown if the object has been unregistered before. } } }
@Override public void doStop() { stopped = true; serverEventBus.unregister(this); if (stopLatch != null) { try { // unpause the processors if they are blocked. this will cause them to see that we are stopping, even if they were paused. if (pausedLatch != null && pausedLatch.getCount() > 0) { pausedLatch.countDown(); } final boolean allStoppedOrderly = stopLatch.await(5, TimeUnit.SECONDS); stopLatch = null; if (!allStoppedOrderly) { // timed out LOG.info( "Stopping Kafka input timed out (waited 5 seconds for consumer threads to stop). Forcefully closing connection now. " + "This is usually harmless when stopping the input."); } } catch (InterruptedException e) { LOG.debug("Interrupted while waiting to stop input."); } } if (cc != null) { cc.shutdown(); cc = null; } }
@Override protected void shutDown() throws Exception { LOG.debug("Stopping InputSetupService"); eventBus.unregister(this); for (IOState<MessageInput> state : inputRegistry.getRunningInputs()) { MessageInput input = state.getStoppable(); LOG.info("Attempting to close input <{}> [{}].", input.getUniqueReadableId(), input.getName()); Stopwatch s = Stopwatch.createStarted(); try { input.stop(); LOG.info("Input <{}> closed. Took [{}ms]", input.getUniqueReadableId(), s.elapsed(TimeUnit.MILLISECONDS)); } catch (Exception e) { LOG.error("Unable to stop input <{}> [{}]: " + e.getMessage(), input.getUniqueReadableId(), input.getName()); } finally { s.stop(); } } LOG.debug("Stopped InputSetupService"); } }
StringCatcher catcher2 = new StringCatcher(); try { bus.unregister(catcher1); fail("Attempting to unregister an unregistered object succeeded"); } catch (IllegalArgumentException expected) { "One correct event should be delivered.", Lists.newArrayList(EVENT), catcher2.getEvents()); bus.unregister(catcher1); bus.post(EVENT); bus.unregister(catcher1); fail("Attempting to unregister an unregistered object succeeded"); } catch (IllegalArgumentException expected) { bus.unregister(catcher2); bus.post(EVENT); assertEquals(
@SuppressWarnings("Duplicates") @Override protected void shutDown() throws Exception { eventBus.unregister(this); // take all tables offline liveTables.clear(); // take the caches and adapters offline and de-register their name/id mappings liveCaches.forEach((name, cache) -> { cache.addListener(new Listener() { @Override public void terminated(State from) { idToCache.remove(cache.id()); liveCaches.remove(name); } }, scheduler); cache.stopAsync(); }); liveAdapters.forEach((name, adapter) -> { adapter.addListener(new Listener() { @Override public void terminated(State from) { idToAdapter.remove(adapter.id()); liveAdapters.remove(name); } }, scheduler); adapter.stopAsync(); }); // Stop data adapter refresh service adapterRefreshService.stopAsync(); }
/** * Unregistering listener. */ public static void unregister(Object listener) { eventBus.unregister(listener); } }
consumer.run(); } catch (IOException e) { eventBus.unregister(this); throw new MisfireException("Could not launch AMQP consumer.", e);
protected void removeMicroservice(String microserviceName) { // must use containsKey and then remove // because removeMicroservice maybe invoked inside "versionsByName.computeIfAbsent" // in this time, containsKey will return false, and will not invoke remove // otherwise, remove will block the thread forever if (versionsByName.containsKey(microserviceName)) { MicroserviceVersions microserviceVersions = versionsByName.remove(microserviceName); appManager.getEventBus().unregister(microserviceVersions); LOGGER.info("remove microservice, appId={}, microserviceName={}.", appId, microserviceName); } }
@Override public void doStop() { serverEventBus.unregister(this); if (scheduledFuture != null) { scheduledFuture.cancel(true); } }
/** * Unregisters the {@link EmailAlerter} from the {@link EventBus}, if an * {@link EmailAlerter} has been set up. */ private void takeDownSmtpAlerter() { if (this.smtpAlerter.get() != null) { this.eventBus.unregister(this.smtpAlerter.get()); } }
protected void removeMicroservice(String microserviceName) { // must use containsKey and then remove // because removeMicroservice maybe invoked inside "versionsByName.computeIfAbsent" // in this time, containsKey will return false, and will not invoke remove // otherwise, remove will block the thread forever if (versionsByName.containsKey(microserviceName)) { MicroserviceVersions microserviceVersions = versionsByName.remove(microserviceName); appManager.getEventBus().unregister(microserviceVersions); LOGGER.info("remove microservice, appId={}, microserviceName={}.", appId, microserviceName); } }
@PreDestroy private void unregister() { clientServerEventBus.unregister(this); syncServerClientEventBus.unregister(this); }