Java 类org.springframework.context.event.ContextStoppedEvent 实例源码

项目:state-channels    文件:NodeServer.java   
@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();
}
项目:astrix    文件:AstrixFrameworkBean.java   
@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();
    }
}
项目:emergentmud    文件:GameShutdownListener.java   
@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);
    }
}
项目:HeliosStreams    文件:MetricRouterBuilder.java   
/**
 * {@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();
        }
    }       
}
项目:stomp    文件:StompSupportConfiguration.java   
@Override
public void onApplicationEvent(final ContextStoppedEvent event) {
    final ApplicationContext applicationContext = event.getApplicationContext();
    for (final StompContext context : applicationContext.getBeansOfType(StompContext.class).values()) {
        context.stop();
    }
}
项目:stomp    文件:StompBrokerProcessor.java   
@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);
        }
    }
}
项目:SwaggerCloud    文件:RegistrationApplicationListener.java   
@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();
}
项目:kc-rice    文件:KSBConfigurer.java   
@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
    if (applicationEvent instanceof ContextRefreshedEvent) {
        doAdditionalContextStartedLogic();
    } else if (applicationEvent instanceof ContextStoppedEvent) {
        doAdditionalContextStoppedLogic();
    }
}
项目:jetstream    文件:ConfigServer.java   
@Override
public void onApplicationEvent(ApplicationEvent event) {

    if (event instanceof ContextStartedEvent) {
        this.startStandAlone();
    } else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) {
        this.stopStandAlone();
    }
}
项目:jetstream    文件:JettyServer.java   
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();
  }
}
项目:realtime-analytics    文件:MetricServer.java   
@Override
public void onApplicationEvent(ApplicationEvent event) {

    if (event instanceof ContextStartedEvent) {
        this.startStandAlone();
    } else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) {
        this.stopStandAlone();
    }
}
项目:rice    文件:KSBConfigurer.java   
@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
    if (applicationEvent instanceof ContextRefreshedEvent) {
        doAdditionalContextStartedLogic();
    } else if (applicationEvent instanceof ContextStoppedEvent) {
        doAdditionalContextStoppedLogic();
    }
}
项目:kuali_rice    文件:KSBConfigurer.java   
@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
    if (applicationEvent instanceof ContextRefreshedEvent) {
        doAdditionalContextStartedLogic();
    } else if (applicationEvent instanceof ContextStoppedEvent) {
        doAdditionalContextStoppedLogic();
    }
}
项目:logistimo-web-service    文件:TaskService.java   
@Override
public void onApplicationEvent(ContextStoppedEvent event) {
  ((AbstractApplicationContext) context).close();
}
项目:lams    文件:AbstractApplicationContext.java   
@Override
public void stop() {
    getLifecycleProcessor().stop();
    publishEvent(new ContextStoppedEvent(this));
}
项目:spring4-understanding    文件:AbstractApplicationContext.java   
@Override
public void stop() {
    getLifecycleProcessor().stop();
    publishEvent(new ContextStoppedEvent(this));
}
项目:my-spring-cache-redis    文件:AbstractApplicationContext.java   
@Override
public void stop() {
    getLifecycleProcessor().stop();
    publishEvent(new ContextStoppedEvent(this));
}
项目:ibole-microservice    文件:RpcClientListenerBean.java   
private void onStoppedEvent(ApplicationEvent event) {
  if (ContextStoppedEvent.class.getName().equals(event.getClass().getName())) {
    RpcClientProvider.provider().getRpcClient().stop();
  }
}
项目:spring    文件:AbstractApplicationContext.java   
@Override
public void stop() {
    getLifecycleProcessor().stop();
    publishEvent(new ContextStoppedEvent(this));
}
项目:metasfresh    文件:ShutdownListener.java   
@Override
public void onApplicationEvent(ContextStoppedEvent event)
{
    Adempiere.instance.setApplicationContext(null);
}
项目:class-guard    文件:AbstractApplicationContext.java   
public void stop() {
    getLifecycleProcessor().stop();
    publishEvent(new ContextStoppedEvent(this));
}