Example #1
0
  /* (non-Javadoc)
   * @see org.dspace.kernel.CommonLifecycle#stop()
   */
  public void stop() {
    if (!running) {
      // log.warn("Kernel ("+this+") is already stopped");
      return;
    }

    synchronized (lock) {
      //            DSpace.initialize(null); // clear out the static cover
      // wipe all the variables to free everything up
      running = false;
      kernel = null;
      if (serviceManagerSystem != null) {
        serviceManagerSystem.shutdown();
      }
      serviceManagerSystem = null;
      configurationService = null;
    }
    // log completion (logger may be gone at this point so we cannot really use it)
    log.info("DSpace kernel shutdown completed and unregistered MBean: " + mBeanName);
  }
Example #2
0
  /**
   * This starts up the entire core system. May be called more than once: subsequent calls return
   * without effect.
   *
   * @param dspaceHome path to DSpace home directory
   */
  public void start(String dspaceHome) {
    if (running) {
      // log.warn("Kernel ("+this+") is already started");
      return;
    }

    synchronized (lock) {
      lastLoadDate = new Date();
      long startTime = System.currentTimeMillis();

      // create the configuration service and get the configuration
      DSpaceConfigurationService dsConfigService = new DSpaceConfigurationService(dspaceHome);
      configurationService = dsConfigService;

      // startup the service manager
      serviceManagerSystem = new DSpaceServiceManager(dsConfigService);
      serviceManagerSystem.startup();

      // initialize the static
      //            DSpace.initialize(serviceManagerSystem);

      loadTime = System.currentTimeMillis() - startTime;

      kernel = this;
      running = true;

      List<KernelStartupCallbackService> callbackServices =
          new DSpace().getServiceManager().getServicesByType(KernelStartupCallbackService.class);
      for (KernelStartupCallbackService callbackService : callbackServices) {
        callbackService.executeCallback();
      }
      // add in the shutdown hook
      registerShutdownHook();
    }
    log.info(
        "DSpace kernel startup completed in "
            + loadTime
            + " ms and registered as MBean: "
            + mBeanName);
  }