Examples of IJobManager


Examples of org.apache.manifoldcf.crawler.interfaces.IJobManager

      IThreadContext tc = ThreadContextFactory.make();

      // Delete all jobs (and wait for them to go away)
      if (daemonThread != null)
      {
        IJobManager jobManager = JobManagerFactory.make(tc);
       
        // Get a list of the current active jobs
        IJobDescription[] jobs = jobManager.getAllJobs();
        int i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Abort this job, if it is running
          try
          {
            jobManager.manualAbort(desc.getID());
          }
          catch (ManifoldCFException e)
          {
            // This generally means that the job was not running
          }
        }
        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Wait for this job to stop
          while (true)
          {
            JobStatus status = jobManager.getStatus(desc.getID());
            if (status != null)
            {
              int statusValue = status.getStatus();
              switch (statusValue)
              {
              case JobStatus.JOBSTATUS_NOTYETRUN:
              case JobStatus.JOBSTATUS_COMPLETED:
              case JobStatus.JOBSTATUS_ERROR:
                break;
              default:
                ManifoldCF.sleep(10000);
                continue;
              }
            }
            break;
          }
        }

        // Now, delete them all
        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          try
          {
            jobManager.deleteJob(desc.getID());
          }
          catch (ManifoldCFException e)
          {
            // This usually means that the job is already being deleted
          }
        }

        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Wait for this job to disappear
          while (true)
          {
            JobStatus status = jobManager.getStatus(desc.getID());
            if (status != null)
            {
              ManifoldCF.sleep(10000);
              continue;
            }
View Full Code Here

Examples of org.apache.manifoldcf.crawler.interfaces.IJobManager

      IThreadContext tc = ThreadContextFactory.make();

      // Delete all jobs (and wait for them to go away)
      if (daemonThread != null)
      {
        IJobManager jobManager = JobManagerFactory.make(tc);
       
        // Get a list of the current active jobs
        IJobDescription[] jobs = jobManager.getAllJobs();
        int i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Abort this job, if it is running
          try
          {
            jobManager.manualAbort(desc.getID());
          }
          catch (ManifoldCFException e)
          {
            // This generally means that the job was not running
          }
        }
        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Wait for this job to stop
          while (true)
          {
            JobStatus status = jobManager.getStatus(desc.getID(),false);
            if (status != null)
            {
              int statusValue = status.getStatus();
              switch (statusValue)
              {
              case JobStatus.JOBSTATUS_NOTYETRUN:
              case JobStatus.JOBSTATUS_COMPLETED:
              case JobStatus.JOBSTATUS_ERROR:
                break;
              default:
                ManifoldCF.sleep(10000);
                continue;
              }
            }
            break;
          }
        }

        // Now, delete them all
        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          try
          {
            jobManager.deleteJob(desc.getID());
          }
          catch (ManifoldCFException e)
          {
            // This usually means that the job is already being deleted
          }
        }

        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Wait for this job to disappear
          while (true)
          {
            JobStatus status = jobManager.getStatus(desc.getID(),false);
            if (status != null)
            {
              ManifoldCF.sleep(10000);
              continue;
            }
View Full Code Here

Examples of org.apache.manifoldcf.crawler.interfaces.IJobManager

      IThreadContext tc = ThreadContextFactory.make();

      // Delete all jobs (and wait for them to go away)
      if (daemonThread != null)
      {
        IJobManager jobManager = JobManagerFactory.make(tc);
       
        // Get a list of the current active jobs
        IJobDescription[] jobs = jobManager.getAllJobs();
        int i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Abort this job, if it is running
          try
          {
            jobManager.manualAbort(desc.getID());
          }
          catch (ManifoldCFException e)
          {
            // This generally means that the job was not running
          }
        }
        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Wait for this job to stop
          while (true)
          {
            JobStatus status = jobManager.getStatus(desc.getID(),false);
            if (status != null)
            {
              int statusValue = status.getStatus();
              switch (statusValue)
              {
              case JobStatus.JOBSTATUS_NOTYETRUN:
              case JobStatus.JOBSTATUS_COMPLETED:
              case JobStatus.JOBSTATUS_ERROR:
                break;
              default:
                ManifoldCF.sleep(10000);
                continue;
              }
            }
            break;
          }
        }

        // Now, delete them all
        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          try
          {
            jobManager.deleteJob(desc.getID());
          }
          catch (ManifoldCFException e)
          {
            // This usually means that the job is already being deleted
          }
        }

        i = 0;
        while (i < jobs.length)
        {
          IJobDescription desc = jobs[i++];
          // Wait for this job to disappear
          while (true)
          {
            JobStatus status = jobManager.getStatus(desc.getID(),false);
            if (status != null)
            {
              ManifoldCF.sleep(10000);
              continue;
            }
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.IJobManager

        myOptions.setTitled(false);
  }

    public void run(final File outputFile, final ExportFinalizationJob finalizationJob)
    throws Exception {
        final IJobManager jobManager = Platform.getJobManager();
        final List resultFiles = new ArrayList();
        final Job[] jobs = createJobs(outputFile, resultFiles);
        final IProgressMonitor monitor = jobManager.createProgressGroup();
        final IProgressMonitor familyMonitor = new IProgressMonitor() {
      public void beginTask(String name, int totalWork) {
        monitor.beginTask(name, totalWork);
      }
      public void done() {
        monitor.done();
      }
      public void internalWorked(double work) {
        monitor.internalWorked(work);
      }
      public boolean isCanceled() {
        return monitor.isCanceled();
      }
      public void setCanceled(boolean value) {
        monitor.setCanceled(value);
        if (value) {
          System.err.println("ExporterBase: canceling value="+EXPORT_JOB_FAMILY);
          jobManager.cancel(EXPORT_JOB_FAMILY);
        }
      }
      public void setTaskName(String name) {
        monitor.setTaskName(name);
      }
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.IJobManager

    WebPublisher() {
    }

    public void run(final File[] exportFiles, final DocumentManager.FTPOptions options, UIFacade uiFacade) {
        IJobManager jobManager = Platform.getJobManager();
        IProgressMonitor monitor = jobManager.createProgressGroup();
          Job startingJob = new Job("starting") {
        protected IStatus run(IProgressMonitor monitor) {
          monitor.beginTask("Publishing files on FTP", exportFiles.length);
          try{
                final URL baseUrl = buildURL(options);
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.IJobManager

     * any remaining dirtyResources of that job to be processed
     * during the current build.
     */
    private void cancelPreviousPerlBuilderJob()
    {
        IJobManager jobMan = Platform.getJobManager();
        Job[] jobs = jobMan.find(PerlBuilderJob.JOB_FAMILY);

        if (jobs.length == 0) return; // no previous build found
       
        jobMan.cancel(PerlBuilderJob.JOB_FAMILY);
        try { jobMan.join(PerlBuilderJob.JOB_FAMILY, null); }
        catch (InterruptedException e)
        {
            // nobody should interrupt our thread in this state;
            // if they do anyway, we treat is as a build cancellation
            throw new OperationCanceledException();
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.IJobManager

        final IResource beam2 = prj.findMember(targetBeamPath);
        assertThat("beam was not removed", beam2, nullValue());
    }

    private void waitJobsToFinish(final Object family) {
        final IJobManager jobMan = Job.getJobManager();
        final Job[] build = jobMan.find(family);
        while (build.length == 1) {
            try {
                build[0].join();
            } catch (final InterruptedException e) {
            }
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.IJobManager

   */
  protected void waitForBuildCompletion() {
    boolean wasInterrupted = false;
    do {
      try {
        IJobManager _jobManager = Job.getJobManager();
        _jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
        wasInterrupted = false;
      } catch (final Throwable _t) {
        if (_t instanceof OperationCanceledException) {
          final OperationCanceledException e = (OperationCanceledException)_t;
          e.printStackTrace();
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.IJobManager

        if (force || fDocumentRead)
          doc= new Document();
        else
          return;

      IJobManager jobMgr= Platform.getJobManager();

      try {
        IStorage storage= input.getStorage();
        // check for null for backward compatibility (we used to check before...)
        if (storage == null)
View Full Code Here

Examples of org.eclipse.core.runtime.jobs.IJobManager

            logPauseWarning(event);
            return;
        }

        if (log.isTraceEnabled()) {
            IJobManager jobManager = Job.getJobManager();
            Job currentJob = jobManager.currentJob();
            if (currentJob != null) {
                currentJob.addJobChangeListener(jobChangeListener);
                log.trace("currentJob='" + currentJob.getName() + "'");
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.