continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r577296 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Date Wed, 19 Sep 2007 13:02:09 GMT
Author: evenisse
Date: Wed Sep 19 06:02:08 2007
New Revision: 577296

URL: http://svn.apache.org/viewvc?rev=577296&view=rev
Log:
Remove project from queues before to delete it

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=577296&r1=577295&r2=577296&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Sep 19 06:02:08 2007
@@ -638,6 +638,33 @@
         return false;
     }
 
+    public boolean removeProjectFromBuildingQueue( int projectId )
+        throws ContinuumException
+    {
+        List queue;
+
+        try
+        {
+            queue = buildQueue.getQueueSnapshot();
+        }
+        catch ( TaskQueueException e )
+        {
+            throw new ContinuumException( "Error while getting the build queue.", e );
+        }
+
+        for ( Iterator it = queue.iterator(); it.hasNext(); )
+        {
+            BuildProjectTask task = (BuildProjectTask) it.next();
+
+            if ( task != null && task.getProjectId() == projectId )
+            {
+                return buildQueue.remove( task );
+            }
+        }
+
+        return false;
+    }
+
     public boolean removeProjectFromCheckoutQueue( int projectId )
         throws ContinuumException
     {
@@ -677,6 +704,16 @@
             Project project = store.getProjectWithBuilds( projectId );
 
             getLogger().info( "Remove project " + project.getName() + "(" + projectId + ")"
);
+
+            if ( isInCheckoutQueue( projectId ) )
+            {
+                removeProjectFromCheckoutQueue( projectId );
+            }
+
+            if ( isInBuildingQueue( projectId ) )
+            {
+                removeProjectFromBuildingQueue( projectId );
+            }
 
             for ( Iterator i = project.getBuildResults().iterator(); i.hasNext(); )
             {



Mime
View raw message