List of usage examples for org.springframework.context.support AbstractApplicationContext stop
@Override public void stop()
From source file:com.platform.camel.app.SpringMain.java
public static void main(String[] args) throws Exception { AbstractApplicationContext springContext = new ClassPathXmlApplicationContext( "META-INF/spring/move-file-context.xml"); springContext.start();//from ww w.j a v a 2 s .co m Thread.sleep(100000); springContext.stop(); }
From source file:org.echocat.nodoodle.server.Main.java
public static void main(String[] args) { final File log4jConfig = new File(System.getProperty("log4j.configuration", "../config/log4j.xml")); if (log4jConfig.isFile()) { try {//from w w w . ja v a 2 s.c o m final FileReader reader = new FileReader(log4jConfig); try { final DOMConfigurator domConfigurator = new DOMConfigurator(); domConfigurator.doConfigure(reader, getLoggerRepository()); } finally { IOUtils.closeQuietly(reader); } } catch (Exception e) { throw new RuntimeException("Could not configure log4j with " + log4jConfig + ".", e); } } final String applicationName = getApplicationName(); //System.setSecurityManager(new ServerSecurityManager()); LOG.info("Starting " + applicationName + "..."); final File config = new File( System.getProperty(Main.class.getPackage().getName() + ".config", "../config/nodoodleServer.xml")); final AbstractApplicationContext applicationContext = new FileSystemXmlApplicationContext(config.getPath()); LOG.info("Starting " + applicationName + "... DONE!"); Runtime.getRuntime().addShutdownHook(new Thread("destroyer") { @Override public void run() { LOG.info("Stopping " + applicationName + "..."); applicationContext.stop(); LOG.info("Stopping " + applicationName + "... DONE!"); } }); }
From source file:org.apache.camel.example.CamelFileSizeCBRMain.java
public static void main(String[] args) throws Exception { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "META-INF/spring/camel-file-size-cbr.xml"); final ProducerTemplate producer = context.getBean("camelTemplate", ProducerTemplate.class); for (int i = 1; i < SIZE; i++) { producer.sendBodyAndHeader("seda:allFiles", getPayload(i), Exchange.FILE_NAME, i + ".txt"); }//from w ww . j a v a 2s .c o m Thread.sleep(100000); context.stop(); }
From source file:org.jbr.commons.container.SpringContainerManager.java
@ManagedOperation(description = "Stop the SpringContainer, if it is running.") public void stopContainer() { if (log.isInfoEnabled()) { log.info("Stopping SpringContainer..."); }//from ww w . j a v a 2 s . co m final AbstractApplicationContext ctx = (AbstractApplicationContext) context; if (ctx.isRunning()) { ctx.stop(); stopTimestamp = Calendar.getInstance(); if (log.isInfoEnabled()) { log.info("SpringContainer stopped !!!"); } } else { if (log.isInfoEnabled()) { log.info("SpringContainer already stopped !!!"); } } }
From source file:org.jumpmind.symmetric.ClientSymmetricEngine.java
@Override public synchronized void stop() { if (this.springContext instanceof AbstractApplicationContext) { AbstractApplicationContext ctx = (AbstractApplicationContext) this.springContext; try {/*w w w . j ava 2s . c o m*/ if (ctx.isActive()) { ctx.stop(); } } catch (Exception ex) { } } super.stop(); }