Class JobManager
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.search.processing.JobManager
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
IndexManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
protected boolean
protected Thread
protected org.eclipse.core.runtime.jobs.Job
static boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked exactly once, in background, before starting processing any jobint
Answer the amount of awaiting jobs.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(String jobFamily)
Remove the index from cache for a given project.void
enable()
boolean
protected boolean
isJobWaiting(IJob request)
protected void
Advance to the next available job, once the current one has been completed.protected void
notifyIdle(long idlingTime)
When idle, give chance to do somethingboolean
performConcurrentJob(IJob searchJob, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor monitor)
This API is allowing to run one job in concurrence with background processing.abstract String
void
void
requestIfNotWaiting(IJob job)
Schedules given job for execution is there is no equal jobs waiting in the queue alreadyvoid
reset()
Flush current statevoid
run()
Infinite loop performing resource indexingvoid
shutdown()
Stop background processing, and wait until the current job is completed before returningtoString()
-
Field Details
-
awaitingJobs
-
executing
protected volatile boolean executing -
processingThread
-
progressJob
protected org.eclipse.core.runtime.jobs.Job progressJob -
VERBOSE
public static boolean VERBOSE -
activated
public boolean activated
-
-
Constructor Details
-
JobManager
public JobManager()
-
-
Method Details
-
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
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() -
isEnabled
public boolean isEnabled()- Returns:
true
if the job manager is enabled
-
discardJobs
Remove the index from cache for a given project. Passing null as a job family discards them all. -
enable
public void enable() -
isJobWaiting
-
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, org.eclipse.core.runtime.IProgressMonitor monitor)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
-
requestIfNotWaiting
Schedules given job for execution is there is no equal jobs waiting in the queue already- Parameters:
job
- a job to schedule (or not)- See Also:
isJobWaiting(IJob)
-
request
-
reset
public void reset()Flush current state -
run
public void run()Infinite loop performing resource indexing -
shutdown
public void shutdown()Stop background processing, and wait until the current job is completed before returning -
toString
-