예제 #1
0
 /**
  * Terminate the provided Tenant ConfigurationContext
  *
  * @param tenantCfgCtx The tenant ConfigurationContext which needs to be terminated
  */
 public static void terminateTenantConfigContext(ConfigurationContext tenantCfgCtx) {
   ConfigurationContext mainServerConfigContext =
       CarbonCoreDataHolder.getInstance().getMainServerConfigContext();
   Map<String, ConfigurationContext> tenantConfigContexts =
       getTenantConfigurationContexts(mainServerConfigContext);
   String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
   log.info("Starting to clean tenant : " + tenantDomain);
   tenantCfgCtx.getAxisConfiguration().getConfigurator().cleanup();
   try {
     doPreConfigContextTermination(tenantCfgCtx);
     tenantCfgCtx.terminate();
     doPostConfigContextTermination(tenantCfgCtx);
     tenantConfigContexts.remove(tenantDomain);
     log.info("Cleaned up tenant " + tenantDomain);
   } catch (AxisFault e) {
     log.error("Cannot cleanup ConfigurationContext of tenant " + tenantDomain, e);
   }
 }
  /** {@inheritDoc} */
  public void destroy() {

    try {
      // only if we have created the server
      if (serverConfigurationInformation.isCreateNewInstance()) {

        // destroy listener manager
        if (listenerManager != null) {
          listenerManager.destroy();
        }

        stopJmxAdapter();
        RMIRegistryController.getInstance().shutDown();

        // we need to call this method to clean the temp files we created.
        if (configurationContext != null) {
          configurationContext.terminate();
        }
      }
      initialized = false;
    } catch (Exception e) {
      log.error("Error stopping the Axis2 Based Server Environment", e);
    }
  }