@EventListener(ContextStoppedEvent.class) public void stop() throws InterruptedException { if (healthCheckSocket != null) { try { healthCheckSocket.close(); healthCheckSocket = null; } catch (Exception e) { log.warn("Failed to close socket", e); } } if (healthChecker != null) { healthChecker.interrupt(); healthChecker.join(); healthChecker = null; } grpcServer.shutdown(); }
@Override public void onApplicationEvent(ApplicationContextEvent event) { if (event instanceof ContextRefreshedEvent && !servicePublisherStarted) { // Application initialization complete. Export astrix-services. if (isServer()) { this.astrixContext.startServicePublisher(); } servicePublisherStarted = true; } else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) { /* * What's the difference between the "stopped" and "closed" event? In our embedded * integration tests we only receive ContextClosedEvent */ destroyAstrixContext(); } }
@Override public void onApplicationEvent(ApplicationContextEvent event) { if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) { List<Entity> everyone = entityRepository.findByXIsNotNullAndYIsNotNullAndZIsNotNull(); GameOutput output = new GameOutput("[red]EmergentMUD is shutting down. Please check back later!"); entityService.sendMessageToListeners(everyone, output); } }
/** * {@inheritDoc} * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) */ @Override public void onApplicationEvent(final ApplicationContextEvent event) { if(event.getApplicationContext()==appCtx) { if(event instanceof ContextRefreshedEvent) { start(); } else if(event instanceof ContextStoppedEvent) { stop(); } } }
@Override public void onApplicationEvent(final ContextStoppedEvent event) { final ApplicationContext applicationContext = event.getApplicationContext(); for (final StompContext context : applicationContext.getBeansOfType(StompContext.class).values()) { context.stop(); } }
@Override public void onApplicationEvent(final ApplicationEvent event) { if (event instanceof ContextStoppedEvent) { try { broker.stop(); } catch (final Exception ex) { throw new RuntimeException("Could not stop broker", ex); } } }
@EventListener @Order(Ordered.LOWEST_PRECEDENCE) public void onApplicationShutdown(ContextStoppedEvent event) { try { register.deregisterApplication(); } catch (Exception ex) { LOGGER.warn("Server is probably down!! No worry you are dead so you don't care, do you?",ex); } stopRegisterTask(); }
@Override public void onApplicationEvent(ApplicationEvent applicationEvent) { if (applicationEvent instanceof ContextRefreshedEvent) { doAdditionalContextStartedLogic(); } else if (applicationEvent instanceof ContextStoppedEvent) { doAdditionalContextStoppedLogic(); } }
@Override public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ContextStartedEvent) { this.startStandAlone(); } else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) { this.stopStandAlone(); } }
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ContextStartedEvent && !isImmediateStart()) { try { start(); } catch (Exception e) { LOGGER.error( e.getLocalizedMessage(), e); } } else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) { stop(); } }
@Override public void onApplicationEvent(ContextStoppedEvent event) { ((AbstractApplicationContext) context).close(); }
@Override public void stop() { getLifecycleProcessor().stop(); publishEvent(new ContextStoppedEvent(this)); }
private void onStoppedEvent(ApplicationEvent event) { if (ContextStoppedEvent.class.getName().equals(event.getClass().getName())) { RpcClientProvider.provider().getRpcClient().stop(); } }
@Override public void onApplicationEvent(ContextStoppedEvent event) { Adempiere.instance.setApplicationContext(null); }
public void stop() { getLifecycleProcessor().stop(); publishEvent(new ContextStoppedEvent(this)); }