示例#1
0
  /** This method will shut down the coadunation base. */
  public void shutdown() {
    try {
      log.info("Shutting down HTTPD");
      httpDaemon.shutdown();
      log.info("Shutting down deployment manager");
      deploymentManager.shutdown();
      log.info("Shutting down the cache registry");
      CacheRegistry.getInstance().shutdown();
      log.info("Stopping the transaction director");
      TransactionDirector.getInstance().stop();
      log.info("Shut down the naming director");
      NamingDirector.getInstance().shutdown();
      log.info("Terminating the local thread group");
      threadGroup.terminate();
      log.info("Terminate the back ground thread");
      RoleManager.getInstance().terminateBackgroundThread();
      log.info("Terminating the session manager");
      sessionManager.shutdown();

    } catch (Exception ex) {
      log.error("Shutdown failed : " + ex.getMessage(), ex);
    }
  }
示例#2
0
  /** Creates a new instance of Main */
  public Runner() throws CoadException {
    // Validate the class loader
    System.out.println("Check the class loader");
    if (!(this.getClass().getClassLoader() instanceof com.rift.coad.BaseClassLoader)) {
      log.error("Invalid class loader");
      System.exit(-1);
    }
    System.out.println("Try and init");
    try {
      Configuration config = ConfigurationFactory.getInstance().getConfig(Runner.class);

      // instanciate the user permissions
      log.info("Init the master class loader");
      MasterClassLoader.init();

      // instanciate the user permissions
      log.info("Init thread permissions");
      permissionContainer = new ThreadsPermissionContainer();
      ThreadsPermissionContainerAccessor.init(permissionContainer);
      log.info("Init session manager");
      SessionManager.init(permissionContainer);
      log.info("Init user store");
      userStoreManager = new UserStoreManager();
      UserStoreManagerAccessor.init(userStoreManager);
      log.info("Init user session manager");
      sessionManager = new UserSessionManager(permissionContainer, userStoreManager);
      sessionManager.startCleanup();
      UserSessionManagerAccessor.init(sessionManager);
      log.info("Init login module");
      LoginManager.init(sessionManager, userStoreManager);

      // add a user to the session for the current thread
      log.info("Init roles");
      RoleManager.getInstance().startBackgroundThread();

      // setup a default user for the current thread
      log.info("Init the default user for the runner");
      Long threadId = new Long(Thread.currentThread().getId());
      permissionContainer.putSession(
          threadId,
          new ThreadPermissionSession(
              threadId, userStoreManager.getUserInfo(config.getString(RUNNER_USER))));

      // instanciate the thread manager
      log.info("Init thread group");
      threadGroup = new CoadunationThreadGroup(sessionManager, userStoreManager);

      // init the interceptor factory
      log.info("Init the interceptor factory");
      InterceptorFactory.init(permissionContainer, sessionManager, userStoreManager);

      // setup the current thread class loader
      log.info("Init the naming director");
      NamingDirector.init(threadGroup);

      log.info("Init the transaction director");
      TransactionDirector.init();

      // instanciate the cache registry
      log.info("Init the cache registry");
      CacheRegistry.init(threadGroup);

      // instanciate the database sources
      log.info("Init data stources");
      DBSourceManager.init();

      // instanciate the bean manager
      log.info("Init coadunation beans");
      beanManager = new BeanManager(permissionContainer, threadGroup);
      BeanConnector.init(beanManager);

      // instanciate the jmx bean manager
      log.info("Init JMX Beans");
      jmxBeanManager = new JMXBeanManager(permissionContainer, threadGroup);
      JMXBeanConnector.init(jmxBeanManager);

      // instanciate the axis engine
      log.info("Init AXIS");
      AxisManager.init();

      // instanciate the web service manager
      log.info("Init Web Service management");
      webServiceManager = new WebServiceManager();
      WebServiceConnector.init(webServiceManager);

      // instanciate the thread manager
      log.info("Init Deployment Loader");
      deploymentManager =
          new DeploymentManager(threadGroup, beanManager, jmxBeanManager, webServiceManager);

      // instanciate the http daemon
      log.info("Init Web Service HTTPD");
      httpDaemon = new HttpDaemon(threadGroup);

    } catch (Exception ex) {
      System.out.println("Failed to start coadunation : " + ex.getMessage());
      ex.printStackTrace(System.out);
      log.error("Failed to start coadunation : " + ex.getMessage(), ex);
      throw new CoadException("Failed start the Coadunation base because : " + ex.getMessage(), ex);
    }
  }