[hg] main-silver: #222975:org.netbeans.modules.parsing.impl.inde...

  • From: Tomas Zezula < >
  • To:
  • Subject: [hg] main-silver: #222975:org.netbeans.modules.parsing.impl.inde...
  • Date: Tue, 04 Dec 2012 09:08:50 -0800

changeset 0426266848bd in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/0426266848bd
description:
        
#222975:org.netbeans.modules.parsing.impl.indexing.CacheFolder.getCacheFolder:
 LowPerformance took 24520 ms

diffstat:

 parsing.api/src/org/netbeans/modules/parsing/impl/indexing/CacheFolder.java 
|  17 +++++++--
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (46 lines):

diff --git 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/CacheFolder.java 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/CacheFolder.java
--- 
a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/CacheFolder.java
+++ 
b/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/CacheFolder.java
@@ -48,6 +48,7 @@
 import java.io.OutputStream;
 import java.net.URL;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -55,6 +56,7 @@
 import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import org.netbeans.api.annotations.common.NonNull;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileSystem;
 import org.openide.filesystems.FileUtil;
@@ -184,16 +186,21 @@
         }
     }
 
-    public static synchronized Iterable<? extends FileObject> 
findRootsWithCacheUnderFolder(FileObject folder) throws IOException {
+    @NonNull
+    public static Iterable<? extends FileObject> 
findRootsWithCacheUnderFolder(@NonNull final FileObject folder) throws 
IOException {
         URL folderURL = folder.toURL();
         String prefix = folderURL.toExternalForm();
-        final FileObject _cacheFolder = getCacheFolder();
-        List<FileObject> result = new LinkedList<FileObject>();
+        final FileObject _cacheFolder;
+        final Map<String,String> isdc;
+        synchronized (CacheFolder.class) {
+            _cacheFolder = getCacheFolder();
         loadSegments(_cacheFolder);
-        for (Entry<String, String> e : invertedSegments.entrySet()) {
+            isdc = new HashMap<String,String>(invertedSegments);
+        }
+        final List<FileObject> result = new LinkedList<FileObject>();
+        for (Entry<String, String> e : isdc.entrySet()) {
             if (e.getKey().startsWith(prefix)) {
                 FileObject fo = URLMapper.findFileObject(new 
URL(e.getKey()));
-                
                 if (fo != null) {
                     result.add(fo);
                 }

[hg] main-silver: #222975:org.netbeans.modules.parsing.impl.inde...

Tomas Zezula 12/04/2012

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close