private void initializeCatalogServices() throws Exception { CatalogDAO c = CatalogDAOFactory.newInstance(); try { c.recoverTransactions(); // Create and configure all Dynamic Site Providers for (Provider provider : c.findAllProviders()) { SiteProviderContext ctxt = new SiteProviderContextInitialisation(provider.getName(), c); SiteProviderFactory.addProvider( ctxt, provider.getPlugin(), provider.getName(), provider.isEnabled(), provider.getConfig()); } // Create and configure External Services for (ExternalService es : c.findAllExternalServices()) { // enclose in try/catch in case an early service fails we still // start the later ones try { ExternalServiceFactory.register(es.getName(), es.getPlugin()); } catch (Exception e) { e.printStackTrace(); } } // GlobalConfigVariableHandler.initializeGlobalVariables(getGlobalVariables(c)); } finally { c.close(); } }
public static void stopServices() throws Exception { MySqlPortal.stop(); TemporaryTable.onStopServices(); if (GroupManager.getCoordinationServices() != null) GroupManager.getCoordinationServices().unRegisterWithGroup(); Host.hostStop(); Agent.stopServices(); CatalogDAOFactory.shutdown(); AutoIncrementTracker.clearCache(); RangeDistributionModel.clearCache(); RandomDistributionModel.clearCache(); SiteProviderFactory.closeSiteProviders(); ExternalServiceFactory.closeExternalServices(); GroupManager.shutdown(); DirectConnectionCache.clearConnectionCache(); }