Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaravanakumar A. Srinivasan2018-09-30 16:38:49 +0000
committerAndrey Loskutov2018-10-03 17:27:18 +0000
commit2a96da744d5fc9380433d64c4a71b4a5a8f15aab (patch)
treef41ee9219b9efd72c0fcd26a476821d02744f9b2
parent8cf83f933796df000fcc1b7d1fb25dcb88784a6b (diff)
downloadeclipse.jdt.core-I20181003-2215.tar.gz
eclipse.jdt.core-I20181003-2215.tar.xz
eclipse.jdt.core-I20181003-2215.zip
Bug 539634: Disable Index Manager when requesting a project indexI20181003-2215I20181003-1800
Change-Id: I0c2585c0c6db17266b676c3dc19ba46136b29ca2 Signed-off-by: Saravanakumar A. Srinivasan <s.srinivasan@salesforce.com>
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java44
1 files changed, 26 insertions, 18 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 9641e9fd40..92e3aad338 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
@@ -570,27 +570,35 @@ public void indexAll(IProject project) {
this.indexer.makeDirty(project);
if (JavaCore.getPlugin() == null) return;
- // Also request indexing of binaries on the classpath
- // determine the new children
try {
- JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
- JavaProject javaProject = (JavaProject) model.getJavaProject(project);
- // only consider immediate libraries - each project will do the same
- // NOTE: force to resolve CP variables before calling indexer - 19303, so that initializers
- // will be run in the current thread.
- IClasspathEntry[] entries = javaProject.getResolvedClasspath();
- for (int i = 0; i < entries.length; i++) {
- IClasspathEntry entry= entries[i];
- if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY)
- indexLibrary(entry.getPath(), project, ((ClasspathEntry)entry).getLibraryIndexLocation());
+ // Disable index manager to avoid synchronization lock contention when adding new index requests to the queue.
+ disable();
+
+ // Also request indexing of binaries on the classpath
+ // determine the new children
+ try {
+ JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
+ JavaProject javaProject = (JavaProject) model.getJavaProject(project);
+ // only consider immediate libraries - each project will do the same
+ // NOTE: force to resolve CP variables before calling indexer - 19303, so that initializers
+ // will be run in the current thread.
+ IClasspathEntry[] entries = javaProject.getResolvedClasspath();
+ for (int i = 0; i < entries.length; i++) {
+ IClasspathEntry entry= entries[i];
+ if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY)
+ indexLibrary(entry.getPath(), project, ((ClasspathEntry)entry).getLibraryIndexLocation());
+ }
+ } catch(JavaModelException e){ // cannot retrieve classpath info
}
- } catch(JavaModelException e){ // cannot retrieve classpath info
- }
- // check if the same request is not already in the queue
- IndexRequest request = new IndexAllProject(project, this);
- if (!isJobWaiting(request))
- request(request);
+ // check if the same request is not already in the queue
+ IndexRequest request = new IndexAllProject(project, this);
+ if (!isJobWaiting(request))
+ request(request);
+ } finally {
+ // Enable index manager after adding all new index requests to the queue.
+ enable();
+ }
}
public void indexLibrary(IPath path, IProject requestingProject, URL indexURL) {
this.indexLibrary(path, requestingProject, indexURL, false);

Back to the top