private void startScheduler() {
    ScheduledExecutorService executorService = Executors.newScheduledThreadPool(5);
    SchedulerTask schedulerTask = new SchedulerTask(repositoryScanner);
    CarbonRuntime carbonRuntime = OSGiServiceHolder.getInstance().getCarbonRuntime();

    int interval = 15;
    if (carbonRuntime != null) {
      interval = carbonRuntime.getConfiguration().getDeploymentConfig().getUpdateInterval();
      logger.debug("Using the specified scheduler update interval of {}", interval);
    } else {
      logger.debug("Using the default deployment scheduler update interval of 15 seconds");
    }
    executorService.scheduleWithFixedDelay(schedulerTask, 0, interval, TimeUnit.SECONDS);
  }
  @Activate
  public void start(BundleContext bundleContext) throws Exception {
    try {
      // Initialize deployment engine and scan it
      String carbonRepositoryLocation =
          carbonRuntime.getConfiguration().getDeploymentConfig().getRepositoryLocation();
      deploymentEngine = new DeploymentEngine(carbonRepositoryLocation);

      logger.debug("Starting Carbon Deployment Engine {}", deploymentEngine);
      deploymentEngine.start();

      // Add deployment engine to the data holder for later usages/references of this object
      OSGiServiceHolder.getInstance().setCarbonDeploymentEngine(deploymentEngine);

      // Register DeploymentService
      DeploymentService deploymentService = new CarbonDeploymentService(deploymentEngine);
      serviceRegistration =
          bundleContext.registerService(DeploymentService.class.getName(), deploymentService, null);

      logger.debug("Started Carbon Deployment Engine");

      // register pending deployers in the list
      for (Deployer deployer : deployerList) {
        try {
          deploymentEngine.registerDeployer(deployer);
        } catch (Exception e) {
          logger.error("Error while adding deployer to the deployment engine", e);
        }
      }

    } catch (DeploymentEngineException e) {
      String msg = "Could not initialize carbon deployment engine";
      logger.error(msg, e);
    } catch (Throwable e) {
      logger.error(e.getMessage(), e);
    }
  }