Commits

Alexander Simon  committed 3a30ee9 Draft

fixed Bug #246119 org.netbeans.modules.deadlock.detector.Detector$DeadlockDetectedException: Code Model Parser 0: Parsing C:\Users\maggi_000\Dropbox\Entwicklung\Projekte\Cpp\Progger\main.cpp

  • Participants
  • Parent commits 2a3f6f7

Comments (0)

Files changed (1)

File cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/core/LibraryManager.java

         this.repositoryId = repositoryId;
     }
     
-    private final Map<LibraryKey, LibraryEntry> librariesEntries = new ConcurrentHashMap<>();
+    private final ConcurrentHashMap<LibraryKey, LibraryEntry> librariesEntries = new ConcurrentHashMap<>();
     
     private static final class Lock {}
     private final Object lock = new Lock();
         return path;
     }
     
-    private ProjectBase searchInProjectFiles(ProjectBase baseProject, ResolvedPath searchFor, Set<ProjectBase> set) {
+    private static ProjectBase searchInProjectFiles(ProjectBase baseProject, ResolvedPath searchFor, Set<ProjectBase> set) {
         if (set.contains(baseProject)) {
             return null;
         }
         return null;
     }
 
-    private ProjectBase searchInProjectFilesArtificial(List<CsmProject> libraries, ResolvedPath searchFor, Set<ProjectBase> antiLoop) {
+    private static ProjectBase searchInProjectFilesArtificial(List<CsmProject> libraries, ResolvedPath searchFor, Set<ProjectBase> antiLoop) {
         for (CsmProject prj : libraries) {
             if (prj.isArtificial()) {
                 antiLoop.clear();
         return null;
     }
 
-    private ProjectBase searchInProjectRoots(ProjectBase baseProject, FileSystem fs, List<CharSequence> folders, Set<ProjectBase> set) {
+    private static ProjectBase searchInProjectRoots(ProjectBase baseProject, FileSystem fs, List<CharSequence> folders, Set<ProjectBase> set) {
         if (set.contains(baseProject)) {
             return null;
         }
         return null;
     }
 
-    private ProjectBase searchInProjectRootsArtificial(List<CsmProject> libraries, FileSystem fs, List<CharSequence> folders, Set<ProjectBase> set) {
+    private static ProjectBase searchInProjectRootsArtificial(List<CsmProject> libraries, FileSystem fs, List<CharSequence> folders, Set<ProjectBase> set) {
         ProjectBase candidate = null;
         for (CsmProject prj : libraries) {
             if (prj.isArtificial()) {
         LibraryEntry entry = librariesEntries.get(libraryKey);
         if (entry == null) {
             boolean needFire = false;
-            synchronized (lock) {
-                entry = librariesEntries.get(libraryKey);
-                if (entry == null) {                    
-                    entry = new LibraryEntry(libraryKey);
-                    librariesEntries.put(libraryKey, entry);
-                    needFire = true;
-                }
+            entry = new LibraryEntry(libraryKey);
+            LibraryEntry old = librariesEntries.putIfAbsent(libraryKey, entry);
+            if (old == null) {
+                needFire = true;
+            } else {
+                entry = old;
             }
             if (needFire) {
                 final LibraryEntry passEntry = entry;