code: protected void abortPublishJob(CmsUUID userId, CmsPublishJobEnqueued publishJob, boolean removeJob)
      throws CmsException, CmsPublishException {
  
          // abort event should be raised before the job is removed implicitly
          m_listeners.fireAbort(userId, publishJob);
  
          if ((m_currentPublishThread == null)
              || !publishJob.m_publishJob.equals(m_currentPublishThread.getPublishJob())) {
              // engine is currently publishing another job or is not publishing
              if (!m_publishQueue.abortPublishJob(publishJob.m_publishJob)) {
                  // job not found
                  throw new CmsPublishException(
                      Messages.get().container(Messages.ERR_PUBLISH_ENGINE_MISSING_PUBLISH_JOB_0));
              }
          } else if (!m_shuttingDown) {
              // engine is currently publishing the job to abort
              m_currentPublishThread.abort();
          } else if (m_shuttingDown && (m_currentPublishThread != null)) {
              // aborting the current job during shut down
              I_CmsReport report = m_currentPublishThread.getReport();
              report.println();
              report.println();
              report.println(
                  Messages.get().container(Messages.RPT_PUBLISH_JOB_ABORT_SHUTDOWN_0),
                  I_CmsReport.FORMAT_ERROR);
              report.println();
          }
  
          // unlock all resources
          if (publishJob.getPublishList() != null) {
              unlockPublishList(publishJob.m_publishJob);
          }
          // keep job if requested
          if (!removeJob) {
              // set finish info
              publishJob.m_publishJob.finish();
              getPublishHistory().add(publishJob.m_publishJob);
          } else {
              getPublishQueue().remove(publishJob.m_publishJob);
          }
      }
docs: Aborts the given publish job.<p>
  
  @param userId the id of user that wants to abort the given publish job
  @param publishJob the publish job to abort
  @param removeJob indicates if the job will be removed or added to history
  
  @throws CmsException if there is some problem during unlocking the resources
  @throws CmsPublishException if the publish job can not be aborted