felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r927834 - /felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
Date Fri, 26 Mar 2010 13:17:34 GMT
Author: dsavage
Date: Fri Mar 26 13:17:34 2010
New Revision: 927834

URL: http://svn.apache.org/viewvc?rev=927834&view=rev
Log:
run project setup outside of synchronized block to avoid potential deadlock

Modified:
    felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java?rev=927834&r1=927833&r2=927834&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
(original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/model/project/SigilProject.java
Fri Mar 26 13:17:34 2010
@@ -392,11 +392,13 @@ public class SigilProject extends Abstra
     {
         ISigilBundle b = null;
         
-        synchronized ( bldProjectFile )
+        try
         {
-            if ( bundle == null )
+            boolean newProject = false;
+            
+            synchronized ( bldProjectFile )
             {
-                try
+                if ( bundle == null )
                 {
                     if ( bldProjectFile.getLocation().toFile().exists() )
                     {
@@ -405,18 +407,22 @@ public class SigilProject extends Abstra
                     else
                     {
                         bundle = setupDefaults();
-                        NullProgressMonitor npm = new NullProgressMonitor();
-                        bldProjectFile.create( buildContents(), true /* force */, npm );
-                        project.refreshLocal( IResource.DEPTH_INFINITE, npm );
+                        newProject = true;
                     }
                 }
-                catch ( CoreException e )
-                {
-                    SigilCore.error( "Failed to build bundle", e );
-                }
+
+                b = bundle;
+            }
+
+            if ( newProject ) {
+                NullProgressMonitor npm = new NullProgressMonitor();
+                bldProjectFile.create( buildContents(), true /* force */, npm );
+                project.refreshLocal( IResource.DEPTH_ONE, npm );
             }
-            
-            b = bundle;
+        }
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to build bundle", e );
         }
         
         return b;
@@ -633,10 +639,6 @@ public class SigilProject extends Abstra
 
     private ISigilBundle parseContents( IFile projectFile ) throws CoreException
     {
-        /*if ( !projectFile.isSynchronized(IResource.DEPTH_ONE) ) {
-        	projectFile.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
-        }*/
-
         if ( projectFile.getName().equals( SigilCore.SIGIL_PROJECT_FILE ) )
         {
             return parseBldContents( projectFile.getLocationURI() );



Mime
View raw message