This is an automated email from the ASF dual-hosted git repository.
skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new abcc339 [NETBEANS-4037] Attempting to avoid querying the
SourceForBinaryQuery for the same root more than once.
new 98c980c Merge pull request #2092 from jlahoda/NETBEANS-4037
abcc339 is described below
commit abcc339bc20a653843814a0cf307d505a32611a7
Author: Jan Lahoda <[email protected]>
AuthorDate: Fri Mar 27 20:26:02 2020 +0100
[NETBEANS-4037] Attempting to avoid querying the SourceForBinaryQuery for
the same root more than once.
---
.../org/netbeans/api/java/classpath/GlobalPathRegistry.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/ide/api.java.classpath/src/org/netbeans/api/java/classpath/GlobalPathRegistry.java
b/ide/api.java.classpath/src/org/netbeans/api/java/classpath/GlobalPathRegistry.java
index 1e0c982..1c960fb 100644
---
a/ide/api.java.classpath/src/org/netbeans/api/java/classpath/GlobalPathRegistry.java
+++
b/ide/api.java.classpath/src/org/netbeans/api/java/classpath/GlobalPathRegistry.java
@@ -23,6 +23,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -303,10 +304,17 @@ public final class GlobalPathRegistry {
}
final List<SourceForBinaryQuery.Result> newResults = new
LinkedList<SourceForBinaryQuery.Result> ();
+ final Set<String> seenEntryURL = new HashSet<>();
final ChangeListener tmpResultListener = new SFBQListener ();
for (ClassPath cp : compileAndBootPaths) {
for (ClassPath.Entry entry : cp.entries()) {
- SourceForBinaryQuery.Result result =
SourceForBinaryQuery.findSourceRoots(entry.getURL());
+ URL url = entry.getURL();
+ String urlKey = url.toString();
+ if (!seenEntryURL.add(urlKey)) {
+ //we have already processed this binary root, skip
+ continue;
+ }
+ SourceForBinaryQuery.Result result =
SourceForBinaryQuery.findSourceRoots(url);
result.addChangeListener(tmpResultListener);
newResults.add (result);
FileObject[] someRoots = result.getRoots();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists