continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r732619 - in /continuum/branches/continuum-parallel-builds: continuum-api/src/main/java/org/apache/continuum/taskqueue/ continuum-core/src/main/java/org/apache/continuum/buildmanager/ continuum-core/src/main/java/org/apache/continuum/taskqu...
Date Thu, 08 Jan 2009 06:04:32 GMT
Author: oching
Date: Wed Jan  7 22:04:32 2009
New Revision: 732619

URL: http://svn.apache.org/viewvc?rev=732619&view=rev
Log:
o implement cancel checkout in parallel builds manager
o cancel checkout of project(s) before deleting a group/project

Modified:
    continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
    continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java

Modified: continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java?rev=732619&r1=732618&r2=732619&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-api/src/main/java/org/apache/continuum/taskqueue/OverallBuildQueue.java
Wed Jan  7 22:04:32 2009
@@ -71,7 +71,7 @@
     * Add checkout tasks to checkout queue.
     * 
     * @param checkoutTasks
- * @throws TaskQueueException TODO
+    * @throws TaskQueueException TODO
     */
     void addToCheckoutQueue( List<Task> checkoutTasks )
         throws TaskQueueException;
@@ -94,6 +94,21 @@
      */
     boolean isInCheckoutQueue( int projectId )
         throws TaskQueueException;
+    
+    /**
+     * Cancel checkout of project.
+     * 
+     * @param projectId
+     * @throws TaskQueueException
+     */
+    void cancelCheckoutTask( int projectId )
+        throws TaskQueueException;
+    
+    /**
+     * Cancel current checkout.
+     * @return TODO
+     */
+    boolean cancelCurrentCheckout();
 
     /**
      * Remove project from checkout queue.

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=732619&r1=732618&r2=732619&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Wed Jan  7 22:04:32 2009
@@ -272,8 +272,18 @@
     public boolean cancelAllCheckouts()
         throws BuildManagerException
     {
-        // TODO Auto-generated method stub
-        return false;
+        synchronized ( overallBuildQueues )
+        {
+            Set<Integer> keySet = overallBuildQueues.keySet();
+            OverallBuildQueue overallBuildQueue = null;
+            for ( Integer key : keySet )
+            {
+                overallBuildQueue = overallBuildQueues.get( key );
+                overallBuildQueue.cancelCurrentCheckout();
+            }
+
+            return true;
+        }
     }
 
     /**
@@ -291,8 +301,22 @@
             }
             else
             {
-                log.info( "Project '" + projectId + "' not found in any of the builds queues."
);
-                //throw new BuildManagerException( "Project not found in any of the build
queues." );
+                synchronized( overallBuildQueues )
+                {
+                    Set<Integer> keySet = overallBuildQueues.keySet();
+                    for( Integer key : keySet )
+                    {
+                        overallBuildQueue = overallBuildQueues.get( key );
+                        BuildProjectTask buildTask = (BuildProjectTask) overallBuildQueue.getBuildTaskQueueExecutor().getCurrentTask();
+                        if( buildTask != null && buildTask.getProjectId() == projectId
)
+                        {
+                            overallBuildQueue.cancelBuildTask( projectId );
+                            return true;
+                        }
+                    }
+                    log.error( "Project '" + projectId + "' not found in any of the builds
queues." );
+                    //throw new BuildManagerException( "Project not found in any of the build
queues." );
+                }
             }
         }
         catch ( TaskQueueException e )
@@ -314,11 +338,26 @@
             OverallBuildQueue overallBuildQueue = getOverallBuildQueueWhereProjectIsQueued(
projectId, CHECKOUT_QUEUE );
             if ( overallBuildQueue != null )
             {
-                overallBuildQueue.getCheckoutTaskQueueExecutor().getCurrentTask();
+                overallBuildQueue.cancelCheckoutTask( projectId );
             }
             else
             {
-                throw new BuildManagerException( "Project not found in any of the checkout
queues." );
+                synchronized( overallBuildQueues )
+                {
+                    Set<Integer> keySet = overallBuildQueues.keySet();
+                    for( Integer key : keySet )
+                    {
+                        overallBuildQueue = overallBuildQueues.get( key );
+                        CheckOutTask checkoutTask = (CheckOutTask) overallBuildQueue.getCheckoutTaskQueueExecutor().getCurrentTask();
                       
+                        if( checkoutTask != null && checkoutTask.getProjectId() ==
projectId )
+                        {
+                            overallBuildQueue.cancelCheckoutTask( projectId );
+                            return true;
+                        }
+                    }
+                    log.info( "Project '" + projectId + "' not found in any of the checkout
queues." );
+                    //throw new BuildManagerException( "Project not found in any of the checkout
queues." );
+                }
             }
         }
         catch ( TaskQueueException e )

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java?rev=732619&r1=732618&r2=732619&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/continuum/taskqueue/DefaultOverallBuildQueue.java
Wed Jan  7 22:04:32 2009
@@ -288,6 +288,21 @@
             buildTaskQueueExecutor.cancelTask( task );
         }        
     }
+    
+    /**
+     * @see OverallBuildQueue#cancelCheckoutTask(int)
+     */
+    public void cancelCheckoutTask( int projectId )
+        throws TaskQueueException
+    {
+        CheckOutTask task = (CheckOutTask) checkoutTaskQueueExecutor.getCurrentTask();
+        if( task != null && task.getProjectId() == projectId )
+        {
+            log.info( "Cancelling checkout task for project '" + projectId + "' in task executor
'" +
+                                 checkoutTaskQueueExecutor );
+            checkoutTaskQueueExecutor.cancelTask( task );
+        }    
+    }
 
     /**
      * @see OverallBuildQueue#cancelCurrentBuild()
@@ -303,6 +318,21 @@
         log.info( "No build task currently executing on build executor: " + buildTaskQueueExecutor
);
         return false;
     }
+    
+    /**
+     * @see OverallBuildQueue#cancelCurrentCheckout()
+     */
+    public boolean cancelCurrentCheckout()
+    {
+        Task task = checkoutTaskQueueExecutor.getCurrentTask();
+        if( task != null )
+        {
+            return checkoutTaskQueueExecutor.cancelTask( task );
+        }
+        
+        log.info( "No checkout task currently executing on checkout task executor: " + checkoutTaskQueueExecutor
);
+        return false;
+    }
 
     /**
      * @see OverallBuildQueue#removeProjectFromBuildQueue(int, int, int, String)

Modified: continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=732619&r1=732618&r2=732619&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Wed Jan  7 22:04:32 2009
@@ -624,6 +624,8 @@
                 
                 parallelBuildsManager.removeProjectFromBuildQueue( projectId );         
      
                 
+                parallelBuildsManager.cancelCheckout( projectId );
+                
                 parallelBuildsManager.cancelBuild( projectId );                
             }
             catch ( BuildManagerException e )



Mime
View raw message