code: protected void waitForActiveJobsAndSubJobsToStop() {
  
          // Don't wait if nothing to wait for...
          if (executingSubWorkUnits.isEmpty() && executingJobs.isEmpty()) {
              return;
          }
  
          try {
              // Hard-coded 2 seconds, until we have a config property
              Thread.sleep(2 * 1000);
          } catch (InterruptedException ie) {
              // Let it interrupt
          }
  
          if (!executingJobs.isEmpty()) {
              logger.log(Level.INFO, "jobs.running.at.shutdown", executingJobs.keySet());
          }
  
          if (!executingSubWorkUnits.isEmpty()) {
  
              logger.fine("The following job executions were still running at the time of deactivation: " + executingSubWorkUnits.keySet().toString());
          }
      }
docs: If jobs are still running (i.e executingWorkUnitSets is not empty),
  then wait a second or two to allow them to finish before shutting down the
  component. If after the wait the jobs are still running, then issue a message
  indicating as such and allow the component to shutdown.
  
  We cannot hold up component shutdown because of outstanding jobs. And we
  cannot forcibly stop a job thread. If the component is deactivating because
  of a config change (e.g. to the persistence service), then you could have problems
  with jobs that "straddle" the update -- i.e. the job starts with one persistence config
  and ends with another. But there's not much we can do here, other than warn the user
  with a message.