当前位置: 首页>>代码示例>>Java>>正文


Java ContextStoppedEvent类代码示例

本文整理汇总了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();
}
 
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:18,代码来源:NodeServer.java

示例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();
	}
}
 
开发者ID:AvanzaBank,项目名称:astrix,代码行数:17,代码来源:AstrixFrameworkBean.java

示例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);
    }
}
 
开发者ID:scionaltera,项目名称:emergentmud,代码行数:10,代码来源:GameShutdownListener.java

示例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();
		}
	}		
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:15,代码来源:MetricRouterBuilder.java

示例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();
    }
}
 
开发者ID:lancomsystems,项目名称:stomp,代码行数:8,代码来源:StompSupportConfiguration.java

示例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);
        }
    }
}
 
开发者ID:lancomsystems,项目名称:stomp,代码行数:11,代码来源:StompBrokerProcessor.java

示例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();
}
 
开发者ID:moronicgeek,项目名称:SwaggerCloud,代码行数:13,代码来源:RegistrationApplicationListener.java

示例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();
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:KSBConfigurer.java

示例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();
    }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:10,代码来源:ConfigServer.java

示例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();
  }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:14,代码来源:JettyServer.java

示例11: onApplicationEvent

import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(ContextStoppedEvent event) {
  ((AbstractApplicationContext) context).close();
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:5,代码来源:TaskService.java

示例12: stop

import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void stop() {
	getLifecycleProcessor().stop();
	publishEvent(new ContextStoppedEvent(this));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:AbstractApplicationContext.java

示例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();
  }
}
 
开发者ID:benson-git,项目名称:ibole-microservice,代码行数:6,代码来源:RpcClientListenerBean.java

示例14: onApplicationEvent

import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
@Override
public void onApplicationEvent(ContextStoppedEvent event)
{
	Adempiere.instance.setApplicationContext(null);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:6,代码来源:ShutdownListener.java

示例15: stop

import org.springframework.context.event.ContextStoppedEvent; //导入依赖的package包/类
public void stop() {
	getLifecycleProcessor().stop();
	publishEvent(new ContextStoppedEvent(this));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:5,代码来源:AbstractApplicationContext.java


注:本文中的org.springframework.context.event.ContextStoppedEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。