List of usage examples for org.springframework.context.support AbstractApplicationContext close
@Override public void close()
From source file:org.trpr.platform.batch.impl.spring.SpringBatchComponentContainer.java
/** * Interface method implementation. Destroys the Spring application context containing loaded job definitions. * @see ComponentContainer#destroy()// w ww. j a va 2 s . c om */ public void destroy() throws PlatformException { for (AbstractApplicationContext context : this.jobsContextList) { context.close(); } this.jobsContextList = null; }
From source file:org.trpr.platform.runtime.impl.bootstrapext.spring.ApplicationContextFactory.java
/** * Interface method implementation. Closes all Spring application contexts that are maintained by this BootstrapExtension * @see org.trpr.platform.runtime.spi.bootstrapext.BootstrapExtension#destroy() *//*from ww w.j a v a2 s .c o m*/ public void destroy() { for (AbstractApplicationContext appContext : ApplicationContextFactory.appContextMap.values()) { appContext.close(); appContext = null; } ApplicationContextFactory.appContextMap.clear(); }
From source file:nz.co.senanque.madura.bundle.BundleManagerImpl.java
public void shutdown() { for (BundleRoot bundleRoot : m_bundleMap.getAvailableBundleRoots()) { AbstractApplicationContext context = (AbstractApplicationContext) bundleRoot.getApplicationContext(); context.close(); }//from www .j a v a2s . c om m_bundleMap.clear(); }
From source file:com.brienwheeler.apps.main.ContextMain.java
@ManagedOperation public String shutdown() { AbstractApplicationContext context = null; int n = 0;//from www . ja v a 2s. c o m do { context = null; synchronized (contextLaunchOrder) { shuttingDown = true; if (contextLaunchOrder.size() > 0) context = contextLaunchOrder.remove(contextLaunchOrder.size() - 1); } if (context != null) { context.close(); n++; } } while (context != null); synchronized (contextLaunchOrder) { shuttingDown = false; contextLaunchOrder.notifyAll(); } return "shutdown " + n + " contexts"; }
From source file:com.linuxbox.enkive.Main.java
protected void runVersionCheck() throws Exception { final AbstractApplicationContext versionCheckingContext = new ClassPathXmlApplicationContext( VERSION_CHECK_CONFIG_FILES); try {//from ww w . ja va 2 s . co m Map<String, DbMigrationService> migrationServices = versionCheckingContext .getBeansOfType(DbMigrationService.class); if (migrationServices.isEmpty()) { final String message = "no version checking / migration services configured"; LOGGER.fatal(message); throw new Exception(message); } for (Entry<String, DbMigrationService> service : migrationServices.entrySet()) { service.getValue().isUpToDate(); } } finally { versionCheckingContext.close(); } }
From source file:org.red5.server.winstone.WinstoneLoader.java
/** * Shut server down./* w w w . j a v a 2s . c om*/ */ public void shutdown() { log.info("Shutting down Winstone context"); //run through the applications and ensure that spring is told //to commence shutdown / disposal AbstractApplicationContext absCtx = (AbstractApplicationContext) LoaderBase.getApplicationContext(); if (absCtx != null) { log.debug("Using loader base application context for shutdown"); //get all the app (web) contexts and shut them down first Map<String, IApplicationContext> contexts = LoaderBase.getRed5ApplicationContexts(); if (contexts.isEmpty()) { log.info("No contexts were found to shutdown"); } for (Map.Entry<String, IApplicationContext> entry : contexts.entrySet()) { //stop the context log.debug("Calling stop on context: {}", entry.getKey()); entry.getValue().stop(); } if (absCtx.isActive()) { log.debug("Closing application context"); absCtx.close(); } } else { log.error("Error getting Spring bean factory for shutdown"); } try { //stop Winstone embedded.shutdown(); //kill the jvm System.exit(0); } catch (Exception e) { log.warn("Winstone could not be stopped", e); throw new RuntimeException("Winstone could not be stopped"); } }
From source file:org.red5.server.undertow.UndertowLoader.java
/** * Shut server down.//ww w .j av a 2 s . co m */ @Override public void destroy() throws Exception { log.info("Shutting down Undertow context"); // run through the applications and ensure that spring is told to commence shutdown / disposal AbstractApplicationContext absCtx = (AbstractApplicationContext) LoaderBase.getApplicationContext(); if (absCtx != null) { log.debug("Using loader base application context for shutdown"); // get all the app (web) contexts and shut them down first Map<String, IApplicationContext> contexts = LoaderBase.getRed5ApplicationContexts(); if (contexts.isEmpty()) { log.info("No contexts were found to shutdown"); } for (Map.Entry<String, IApplicationContext> entry : contexts.entrySet()) { // stop the context log.debug("Calling stop on context: {}", entry.getKey()); entry.getValue().stop(); } if (absCtx.isActive()) { log.debug("Closing application context"); absCtx.close(); } } else { log.error("Error getting Spring bean factory for shutdown"); } try { // stop undertow server.stop(); } catch (Exception e) { log.warn("Undertow could not be stopped", e); throw new RuntimeException("Undertow could not be stopped"); } }
From source file:org.red5.server.tomcat.TomcatLoader.java
/** * Shut server down./*from w ww . ja va 2s . c o m*/ */ public void shutdown() { log.info("Shutting down Tomcat context"); //run through the applications and ensure that spring is told //to commence shutdown / disposal AbstractApplicationContext absCtx = (AbstractApplicationContext) LoaderBase.getApplicationContext(); if (absCtx != null) { log.debug("Using loader base application context for shutdown"); //get all the app (web) contexts and shut them down first Map<String, IApplicationContext> contexts = LoaderBase.getRed5ApplicationContexts(); if (contexts.isEmpty()) { log.info("No contexts were found to shutdown"); } for (Map.Entry<String, IApplicationContext> entry : contexts.entrySet()) { //stop the context log.debug("Calling stop on context: {}", entry.getKey()); entry.getValue().stop(); } if (absCtx.isActive()) { log.debug("Closing application context"); absCtx.close(); } } else { log.error("Error getting Spring bean factory for shutdown"); } //shutdown jmx JMXAgent.shutdown(); try { //stop tomcat embedded.stop(); //kill the jvm System.exit(0); } catch (Exception e) { log.warn("Tomcat could not be stopped", e); throw new RuntimeException("Tomcat could not be stopped"); } }
From source file:org.antczak.hadoop.holidays.Application.java
public static void main(String[] args) throws Exception { log.info("Holidays with HDFS Application Running"); AbstractApplicationContext context = new ClassPathXmlApplicationContext("/application-context.xml", Application.class); context.registerShutdownHook();//from w w w. jav a 2 s. c om context.close(); log.info("Holidays with HDFS Application Finished"); }
From source file:org.antczak.hadoop.wordcount.Application.java
public static void main(String[] args) throws Exception { log.info("Wordcount with HDFS Application Running"); AbstractApplicationContext context = new ClassPathXmlApplicationContext("/application-context.xml", Application.class); context.registerShutdownHook();/*from w w w . java 2s . c om*/ context.close(); log.info("Wordcount with HDFS Application Finished"); }