本文整理了Java中org.springframework.context.ConfigurableApplicationContext.stop()
方法的一些代码示例,展示了ConfigurableApplicationContext.stop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConfigurableApplicationContext.stop()
方法的具体详情如下:
包路径:org.springframework.context.ConfigurableApplicationContext
类名称:ConfigurableApplicationContext
方法名:stop
暂无
代码示例来源:origin: spring-projects/spring-framework
@Test
public void contextEventsAreReceived() {
load(ContextEventListener.class);
ContextEventListener listener = this.context.getBean(ContextEventListener.class);
List<Object> events = this.eventCollector.getEvents(listener);
assertEquals("Wrong number of initial context events", 1, events.size());
assertEquals(ContextRefreshedEvent.class, events.get(0).getClass());
this.context.stop();
List<Object> eventsAfterStop = this.eventCollector.getEvents(listener);
assertEquals("Wrong number of context events on shutdown", 2, eventsAfterStop.size());
assertEquals(ContextStoppedEvent.class, eventsAfterStop.get(1).getClass());
this.eventCollector.assertTotalEventsCount(2);
}
代码示例来源:origin: spring-projects/spring-integration-samples
@Test
public void testSequentialFileProcessing() throws Exception {
logger.info("\n\n#### Starting Sequential processing test ####");
logger.info("Populating directory with files");
for (int i = 0; i < fileCount; i++) {
File file = new File("input/file_" + i + ".txt");
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write("hello " + i);
out.close();
}
logger.info("Populated directory with files");
Thread.sleep(2000);
logger.info("Starting Spring Integration Sequential File processing");
ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("META-INF/spring/integration/sequentialFileProcessing-config.xml");
PollableChannel filesOutChannel = ac.getBean("filesOutChannel", PollableChannel.class);
for (int i = 0; i < fileCount; i++) {
logger.info("Finished processing " + filesOutChannel.receive(10000).getPayload());
}
ac.stop();
}
@Test
代码示例来源:origin: spring-cloud/spring-cloud-gateway
@After
public void stop() throws Exception {
if (this.client instanceof Lifecycle) {
((Lifecycle) this.client).stop();
}
this.server.stop();
if (this.gatewayContext != null) {
this.gatewayContext.stop();
}
}
代码示例来源:origin: org.springframework.cloud/spring-cloud-context
public synchronized void doPause() {
if (this.context != null) {
this.context.stop();
}
}
代码示例来源:origin: spring-projects/spring-integration
@After
public void after() {
this.context.stop();
}
代码示例来源:origin: spring-projects/spring-integration
@AfterAll
public static void tearDown(ConfigurableApplicationContext context) {
context.stop(); // prevent queues from being redeclared after deletion
RabbitAvailableCondition.getBrokerRunning().removeTestQueues("si.dsl.exception.test",
"si.dsl.conv.exception.test");
}
代码示例来源:origin: tuxdevelop/spring-batch-lightmin
@Override
public void stop() {
if (this.applicationContext != null) {
this.applicationContext.stop();
}
this.listenerStatus = ListenerStatus.STOPPED;
}
代码示例来源:origin: spring-cloud/spring-cloud-commons
public synchronized void doPause() {
if (this.context != null) {
this.context.stop();
}
}
代码示例来源:origin: org.tuxdevelop/spring-batch-lightmin-core-configuration
@Override
public void stop() {
if (this.applicationContext != null) {
this.applicationContext.stop();
}
this.listenerStatus = ListenerStatus.STOPPED;
}
代码示例来源:origin: pl.edu.icm.synat/synat-platform-osgi
/**
* close application context
*/
@Override
public void destroy() {
applicationContext.stop();
applicationContext.close();
}
代码示例来源:origin: com.coherentlogic.cmr.api/cmr-api-core-boot
@PreDestroy
public void stop () {
applicationContext.stop();
applicationContext.close();
}
代码示例来源:origin: ihaolin/diablo
@Override
public void run() {
try {
Thread.sleep(500L);
} catch (InterruptedException ex) {
// Swallow exception and continue
}
context.stop();
System.exit(0);
}
}).start();
代码示例来源:origin: NationalSecurityAgency/datawave
@Override
public void stop() {
lock.readLock().lock();
try {
configurableApplicationContext.stop();
} finally {
lock.readLock().unlock();
}
}
代码示例来源:origin: Kurento/kurento-java
private void stopContext() {
if (context != null && context.isRunning()) {
context.stop();
context.close();
}
}
代码示例来源:origin: org.springframework.xd/spring-xd-module
@Override
public void stop() {
if (context.isActive()) {
context.stop(); // Shouldn't need to close() as well?
}
}
代码示例来源:origin: org.kurento/kurento-test
private void stopContext() {
if (context != null && context.isRunning()) {
context.stop();
context.close();
}
}
代码示例来源:origin: spring-projects/spring-bus
@Override
@ManagedOperation
public void stop() {
if (this.running) {
if (!this.active.get()) {
if (this.active.compareAndSet(false, true)) {
unbindChannels();
this.applicationContext.stop();
this.active.set(false);
}
}
}
this.running = false;
}
代码示例来源:origin: spring-cloud/spring-cloud-dataflow
@Override
protected void after() {
try {
application.stop();
}
finally {
if (originalOAuth2Port != null) {
System.setProperty(OAUTH2_PORT_PROPERTY, originalOAuth2Port);
}
else {
System.clearProperty(OAUTH2_PORT_PROPERTY);
}
}
}
代码示例来源:origin: spring-cloud/spring-cloud-skipper
@Override
protected void after() {
try {
application.stop();
}
finally {
if (originalOAuth2Port != null) {
System.setProperty(OAUTH2_PORT_PROPERTY, originalOAuth2Port);
}
else {
System.clearProperty(OAUTH2_PORT_PROPERTY);
}
}
}
代码示例来源:origin: com.opentable.components/otj-server-core
@After
public void after() {
Assert.assertNotNull(context);
Assert.assertNotNull(port);
port = null;
context.stop();
context.close();
context = null;
client.close();
}
内容来源于网络,如有侵权,请联系作者删除!