ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r987749 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer: IvyResolveJob.java IvyResolveJobThread.java RefreshFolderJob.java
Date Sat, 21 Aug 2010 13:08:36 GMT
Author: hibou
Date: Sat Aug 21 13:08:36 2010
New Revision: 987749

URL: http://svn.apache.org/viewvc?rev=987749&view=rev
Log:
IVYDE-177
* avoid some dead lock if there is some folder refresh to do
* make the sorting of project inter dependencies actually work

Added:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java
  (with props)
Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java?rev=987749&r1=987748&r2=987749&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
Sat Aug 21 13:08:36 2010
@@ -130,7 +130,7 @@ public class IvyResolveJob extends Job {
             WarningNonMatchingVersionReporter nonMatchingVersionReporter = new WarningNonMatchingVersionReporter();
             CircularDependencyStrategy circularDependencyStrategy = WarnCircularDependencyStrategy
                     .getInstance();
-            ModuleDescriptorSorter sorter = new ModuleDescriptorSorter(inworkspaceModules.values(),
+            ModuleDescriptorSorter sorter = new ModuleDescriptorSorter(inworkspaceModules.keySet(),
                     versionMatcher, nonMatchingVersionReporter, circularDependencyStrategy);
             List sortedModuleDescriptors = sorter.sortModuleDescriptors();
 
@@ -198,6 +198,7 @@ public class IvyResolveJob extends Job {
         boolean usePreviousResolveIfExist = request.isUsePreviousResolveIfExist();
         IvyResolveJobThread resolver = new IvyResolveJobThread(conf, ivy, md,
                 usePreviousResolveIfExist, monitor);
+        resolver.setName("IvyDE resolver thread");
 
         resolver.start();
         while (true) {

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java?rev=987749&r1=987748&r2=987749&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJobThread.java
Sat Aug 21 13:08:36 2010
@@ -230,7 +230,8 @@ public class IvyResolveJobThread extends
 
         all = new LinkedHashSet();
         for (int i = 0; i < confs.length; i++) {
-            ConfigurationResolveReport configurationReport = report.getConfigurationReport(confs[i]);
+            ConfigurationResolveReport configurationReport = report
+                    .getConfigurationReport(confs[i]);
             Set revisions = configurationReport.getModuleRevisionIds();
             for (Iterator it = revisions.iterator(); it.hasNext();) {
                 ModuleRevisionId revId = (ModuleRevisionId) it.next();
@@ -342,18 +343,12 @@ public class IvyResolveJobThread extends
                     .split(inheritedRetrieveTypes)));
         }
         int numberOfItemsRetrieved = ivy.retrieve(md.getModuleRevisionId(), pattern, c);
-        try {
-            if (numberOfItemsRetrieved > 0 ){
-                // Only refresh if we actually retrieved a file.
-                monitor.setTaskName("refreshing after retrieve for pattern: " + pattern);
-                String refreshPath = IvyPatternHelper.getTokenRoot(conf.getInheritedRetrievePattern());
-                IFolder folder = conf.getJavaProject().getProject().getFolder(refreshPath);
-                folder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
-            }
-        } catch (CoreException e) {
-            // we shouldn't get any conflict in resource changes notifications, the job running
-            // this thread should be started with proper exclude rules
-            throw new RuntimeException("Refresh after resolve is conflicting with another
job", e);
+        if (numberOfItemsRetrieved > 0) {
+            // Only refresh if we actually retrieved a file.
+            String refreshPath = IvyPatternHelper.getTokenRoot(conf.getInheritedRetrievePattern());
+            IFolder folder = conf.getJavaProject().getProject().getFolder(refreshPath);
+            RefreshFolderJob refreshFolderJob = new RefreshFolderJob(folder);
+            refreshFolderJob.schedule();
         }
     }
 

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java?rev=987749&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java
(added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java
Sat Aug 21 13:08:36 2010
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.cpcontainer;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+public class RefreshFolderJob extends WorkspaceJob {
+
+    private final IFolder folder;
+
+    public RefreshFolderJob(IFolder folder) {
+        super("IvyDE refresh " + folder);
+        this.folder = folder;
+    }
+
+    public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
+        if (monitor != null && monitor.isCanceled()) {
+            return Status.CANCEL_STATUS;
+        }
+        folder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+        if (monitor != null && monitor.isCanceled()) {
+            return Status.CANCEL_STATUS;
+        }
+        return Status.OK_STATUS;
+    }
+
+}

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/RefreshFolderJob.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message