org.aspectj.org.eclipse.jdt.internal.core.search.processing
Class JobManager

java.lang.Object
  extended by org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
IndexManager

public abstract class JobManager
extends java.lang.Object
implements java.lang.Runnable


Field Summary
 boolean activated
           
protected  IJob[] awaitingJobs
           
protected  boolean executing
           
protected  int jobEnd
           
protected  int jobStart
           
protected  java.lang.Thread processingThread
           
protected  Job progressJob
           
static boolean VERBOSE
           
 
Constructor Summary
JobManager()
           
 
Method Summary
 void activateProcessing()
          Invoked exactly once, in background, before starting processing any job
 int awaitingJobsCount()
          Answer the amount of awaiting jobs.
 IJob currentJob()
          Answers the first job in the queue, or null if there is no job available Until the job has completed, the job manager will keep answering the same job.
 void disable()
           
 void discardJobs(java.lang.String jobFamily)
          Remove the index from cache for a given project.
 void enable()
           
protected  boolean isJobWaiting(IJob request)
           
protected  void moveToNextJob()
          Advance to the next available job, once the current one has been completed.
protected  void notifyIdle(long idlingTime)
          When idle, give chance to do something
 boolean performConcurrentJob(IJob searchJob, int waitingPolicy, IProgressMonitor progress)
          This API is allowing to run one job in concurrence with background processing.
abstract  java.lang.String processName()
           
 void request(IJob job)
           
 void reset()
          Flush current state
 void run()
          Infinite loop performing resource indexing
 void shutdown()
          Stop background processing, and wait until the current job is completed before returning
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

awaitingJobs

protected IJob[] awaitingJobs

jobStart

protected int jobStart

jobEnd

protected int jobEnd

executing

protected boolean executing

processingThread

protected java.lang.Thread processingThread

progressJob

protected Job progressJob

VERBOSE

public static boolean VERBOSE

activated

public boolean activated
Constructor Detail

JobManager

public JobManager()
Method Detail

activateProcessing

public void activateProcessing()
Invoked exactly once, in background, before starting processing any job


awaitingJobsCount

public int awaitingJobsCount()
Answer the amount of awaiting jobs.


currentJob

public IJob currentJob()
Answers the first job in the queue, or null if there is no job available Until the job has completed, the job manager will keep answering the same job.


disable

public void disable()

discardJobs

public void discardJobs(java.lang.String jobFamily)
Remove the index from cache for a given project. Passing null as a job family discards them all.


enable

public void enable()

isJobWaiting

protected boolean isJobWaiting(IJob request)

moveToNextJob

protected void moveToNextJob()
Advance to the next available job, once the current one has been completed. Note: clients awaiting until the job count is zero are still waiting at this point.


notifyIdle

protected void notifyIdle(long idlingTime)
When idle, give chance to do something


performConcurrentJob

public boolean performConcurrentJob(IJob searchJob,
                                    int waitingPolicy,
                                    IProgressMonitor progress)
This API is allowing to run one job in concurrence with background processing. Indeed since other jobs are performed in background, resource sharing might be an issue.Therefore, this functionality allows a given job to be run without colliding with background ones. Note: multiple thread might attempt to perform concurrent jobs at the same time, and should synchronize (it is deliberately left to clients to decide whether concurrent jobs might interfere or not. In general, multiple read jobs are ok). Waiting policy can be: IJobConstants.ForceImmediateSearch IJobConstants.CancelIfNotReadyToSearch IJobConstants.WaitUntilReadyToSearch


processName

public abstract java.lang.String processName()

request

public void request(IJob job)

reset

public void reset()
Flush current state


run

public void run()
Infinite loop performing resource indexing

Specified by:
run in interface java.lang.Runnable

shutdown

public void shutdown()
Stop background processing, and wait until the current job is completed before returning


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object