本文整理汇总了Java中org.springframework.context.event.ContextStoppedEvent类的典型用法代码示例。如果您正苦于以下问题:Java ContextStoppedEvent类的具体用法?Java ContextStoppedEvent怎么用?Java ContextStoppedEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContextStoppedEvent类属于org.springframework.context.event包,在下文中一共展示了ContextStoppedEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@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();
}
示例2: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@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();
}
}
示例3: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@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);
}
}
示例4: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
/**
* {@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();
}
}
}
示例5: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(final ContextStoppedEvent event) {
final ApplicationContext applicationContext = event.getApplicationContext();
for (final StompContext context : applicationContext.getBeansOfType(StompContext.class).values()) {
context.stop();
}
}
示例6: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@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);
}
}
}
示例7: onApplicationShutdown
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@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();
}
示例8: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
if (applicationEvent instanceof ContextRefreshedEvent) {
doAdditionalContextStartedLogic();
} else if (applicationEvent instanceof ContextStoppedEvent) {
doAdditionalContextStoppedLogic();
}
}
示例9: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ContextStartedEvent) {
this.startStandAlone();
} else if (event instanceof ContextClosedEvent || event instanceof ContextStoppedEvent) {
this.stopStandAlone();
}
}
示例10: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
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();
}
}
示例11: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(ContextStoppedEvent event) {
((AbstractApplicationContext) context).close();
}
示例12: stop
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void stop() {
getLifecycleProcessor().stop();
publishEvent(new ContextStoppedEvent(this));
}
示例13: onStoppedEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
private void onStoppedEvent(ApplicationEvent event) {
if (ContextStoppedEvent.class.getName().equals(event.getClass().getName())) {
RpcClientProvider.provider().getRpcClient().stop();
}
}
示例14: onApplicationEvent
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(ContextStoppedEvent event)
{
Adempiere.instance.setApplicationContext(null);
}
示例15: stop
import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
public void stop() {
getLifecycleProcessor().stop();
publishEvent(new ContextStoppedEvent(this));
}