Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java6
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java13
2 files changed, 15 insertions, 4 deletions
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java
index 41efb7e1e9..37666c778c 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java
@@ -593,8 +593,7 @@ public void indexAll(IProject project) {
// check if the same request is not already in the queue
IndexRequest request = new IndexAllProject(project, this);
- if (!isJobWaiting(request))
- request(request);
+ requestIfNotWaiting(request);
} finally {
// Enable index manager after adding all new index requests to the queue.
enable();
@@ -652,8 +651,7 @@ public void indexLibrary(IPath path, IProject requestingProject, URL indexURL, f
}
// check if the same request is not already in the queue
- if (!isJobWaiting(request))
- request(request);
+ requestIfNotWaiting(request);
}
synchronized boolean addIndex(IPath containerPath, IndexLocation indexFile) {
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
index 1ccc768d07..6bcb2a294c 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java
@@ -272,6 +272,19 @@ public abstract class JobManager implements Runnable {
}
public abstract String processName();
+ /**
+ * Schedules given job for execution is there is no equal jobs waiting in the queue already
+ *
+ * @see JobManager#isJobWaiting(IJob)
+ * @param job
+ * a job to schedule (or not)
+ */
+ public synchronized void requestIfNotWaiting(IJob job) {
+ if(!isJobWaiting(job)) {
+ request(job);
+ }
+ }
+
public synchronized void request(IJob job) {
job.ensureReadyToRun();

Back to the top