public void stop(final StopContext stopContext) {
   final ServiceController<?> serviceController =
       stopContext
           .getController()
           .getServiceContainer()
           .getService(CommonDeploymentService.getServiceName(jndiName));
   if (serviceController != null) {
     serviceController.setMode(ServiceController.Mode.REMOVE);
   }
   ExecutorService executorService = executor.getValue();
   Runnable r =
       new Runnable() {
         @Override
         public void run() {
           try {
             stopService();
           } finally {
             stopContext.complete();
           }
         }
       };
   try {
     executorService.execute(r);
   } catch (RejectedExecutionException e) {
     r.run();
   } finally {
     stopContext.asynchronous();
   }
 }
  public synchronized void start(StartContext startContext) throws StartException {
    try {
      final ServiceContainer container = startContext.getController().getServiceContainer();

      deploymentMD = getDeployer().deploy(container);
      if (deploymentMD.getCfs().length != 1) {
        throw ConnectorLogger.ROOT_LOGGER.cannotStartDs();
      }
      sqlDataSource =
          new WildFlyDataSource(
              (javax.sql.DataSource) deploymentMD.getCfs()[0], jndiName.getAbsoluteJndiName());
      DS_DEPLOYER_LOGGER.debugf("Adding datasource: %s", deploymentMD.getCfJndiNames()[0]);
      CommonDeploymentService cdService = new CommonDeploymentService(deploymentMD);
      final ServiceName cdServiceName = CommonDeploymentService.getServiceName(jndiName);
      startContext
          .getController()
          .getServiceContainer()
          .addService(cdServiceName, cdService)
          // The dependency added must be the JNDI name which for subsystem resources is an alias.
          // This service
          // is also used in deployments where the capability service name is not registered for the
          // service.
          .addDependency(getServiceName(jndiName))
          .setInitialMode(ServiceController.Mode.ACTIVE)
          .install();
    } catch (Throwable t) {
      throw ConnectorLogger.ROOT_LOGGER.deploymentError(t, dsName);
    }
  }