List of usage examples for javax.resource.spi ResourceAdapter stop
void stop();
From source file:org.bytesoft.openjtcc.supports.spring.web.TransactionResourceAdapterListener.java
public void contextDestroyed(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); WebApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); ResourceAdapter resourceAdapter = (ResourceAdapter) applicationContext.getBean(ResourceAdapter.class); resourceAdapter.stop(); }
From source file:org.apache.openejb.assembler.classic.Assembler.java
public synchronized void destroy() { try {// w w w . j a va 2 s . c o m EjbTimerServiceImpl.shutdown(); } catch (Exception e) { logger.warning("Unable to shutdown scheduler", e); } logger.debug("Undeploying Applications"); Assembler assembler = this; for (AppInfo appInfo : assembler.getDeployedApplications()) { try { assembler.destroyApplication(appInfo.path); } catch (UndeployException e) { logger.error("Undeployment failed: " + appInfo.path, e); } catch (NoSuchApplicationException e) { } } NamingEnumeration<Binding> namingEnumeration = null; try { namingEnumeration = containerSystem.getJNDIContext().listBindings("openejb/Resource"); } catch (NamingException ignored) { // no resource adapters were created } while (namingEnumeration != null && namingEnumeration.hasMoreElements()) { Binding binding = namingEnumeration.nextElement(); Object object = binding.getObject(); if (object instanceof ResourceAdapter) { ResourceAdapter resourceAdapter = (ResourceAdapter) object; try { logger.info("Stopping ResourceAdapter: " + binding.getName()); if (logger.isDebugEnabled()) { logger.debug("Stopping ResourceAdapter: " + binding.getClassName()); } resourceAdapter.stop(); } catch (Throwable t) { logger.fatal("ResourceAdapter Shutdown Failed: " + binding.getName(), t); } } else if (object instanceof org.apache.commons.dbcp.BasicDataSource) { logger.info("Closing DataSource: " + binding.getName()); try { ((org.apache.commons.dbcp.BasicDataSource) object).close(); } catch (Throwable t) { //Ignore } } else if (logger.isDebugEnabled()) { logger.debug("Not processing resource on destroy: " + binding.getClassName()); } } SystemInstance.get().removeComponent(OpenEjbConfiguration.class); SystemInstance.get().removeComponent(JtaEntityManagerRegistry.class); SystemInstance.get().removeComponent(TransactionSynchronizationRegistry.class); SystemInstance.get().removeComponent(EjbResolver.class); SystemInstance.reset(); }