continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r781915 - in /continuum/branches/continuum-1.3.x: continuum-api/src/main/java/org/apache/continuum/buildmanager/ continuum-core/src/main/java/org/apache/continuum/buildmanager/ continuum-core/src/main/java/org/apache/maven/continuum/
Date Fri, 05 Jun 2009 05:53:47 GMT
Author: ctan
Date: Fri Jun  5 05:53:47 2009
New Revision: 781915

URL: http://svn.apache.org/viewvc?rev=781915&view=rev
Log:
[CONTINUUM-2259] added a check to prevent adding project to the prepare build queue if it's
already in the prepare build queue or is currently building

Modified:
    continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
    continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java

Modified: continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java?rev=781915&r1=781914&r2=781915&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-api/src/main/java/org/apache/continuum/buildmanager/BuildsManager.java
Fri Jun  5 05:53:47 2009
@@ -364,6 +364,16 @@
         throws BuildManagerException;
 
     /**
+     * Checks whether project is currently preparing build
+     * 
+     * @param projectId
+     * @return
+     * @throws BuildManagerException
+     */
+    boolean isProjectCurrentlyPreparingBuild( int projectId )
+        throws BuildManagerException;
+
+    /**
      * Return currently preparing build project.
      * @return
      * @throws BuildManagerException

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java?rev=781915&r1=781914&r2=781915&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/continuum/buildmanager/ParallelBuildsManager.java
Fri Jun  5 05:53:47 2009
@@ -500,6 +500,7 @@
                 CheckOutTask task = checkouts.get( key );
                 if ( task.getProjectId() == projectId )
                 {
+                    log.info( "Project " + projectId + " is currently being checked out"
);
                     return true;
                 }
             }
@@ -528,6 +529,7 @@
 
                         if ( projectIds.contains( new Integer( projectId ) ) )
                         {
+                            log.info( "Project " + projectId + " is in prepare build queue"
);
                             return true;
                         }
                     }
@@ -558,6 +560,7 @@
                     (BuildProjectTask) overallBuildQueue.getBuildTaskQueueExecutor().getCurrentTask();
                 if ( task != null && task.getProjectId() == projectId )
                 {
+                    log.info( "Project " + projectId + " is currently building in " + overallBuildQueue.getName()
);
                     return true;
                 }
             }
@@ -1061,6 +1064,30 @@
         }
     }
 
+    public boolean isProjectCurrentlyPreparingBuild( int projectId )
+        throws BuildManagerException
+    {
+        PrepareBuildProjectsTask task = getCurrentProjectInPrepareBuild();
+
+        if ( task != null )
+        {
+            Map<Integer, Integer> map = task.getProjectsBuildDefinitionsMap();
+
+            if ( map.size() > 0 )
+            {
+                Set<Integer> projectIds = map.keySet();
+
+                if ( projectIds.contains( new Integer( projectId ) ) )
+                {
+                    log.info( "Project " + projectId + " is currently preparing build" );
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
     public PrepareBuildProjectsTask getCurrentProjectInPrepareBuild()
         throws BuildManagerException
     {
@@ -1140,6 +1167,7 @@
                     {
                         if ( overallBuildQueue.isInBuildQueue( projectId ) )
                         {
+                            log.info( "Project " + projectId + " is in build queue " + overallBuildQueue.getName()
);
                             return true;
                         }
                     }
@@ -1147,6 +1175,7 @@
                     {
                         if ( overallBuildQueue.isInBuildQueue( projectId, buildDefinitionId
) )
                         {
+                            log.info( "Project " + projectId + " is in build queue " + overallBuildQueue.getName()
);
                             return true;
                         }
                     }
@@ -1155,6 +1184,7 @@
                 {
                     if ( overallBuildQueue.isInCheckoutQueue( projectId ) )
                     {
+                        log.info( "Project " + projectId + " is in checkout queue " + overallBuildQueue.getName()
);
                         return true;
                     }
                 }

Modified: continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=781915&r1=781914&r2=781915&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Fri Jun  5 05:53:47 2009
@@ -964,7 +964,8 @@
                         if ( buildDefId != null &&
                             !parallelBuildsManager.isInAnyBuildQueue( project.getId(), buildDefId
) &&
                             !parallelBuildsManager.isInAnyCheckoutQueue( project.getId()
) &&
-                            !parallelBuildsManager.isInPrepareBuildQueue( project.getId()
) )
+                            !parallelBuildsManager.isInPrepareBuildQueue( project.getId()
) &&
+                            !parallelBuildsManager.isProjectCurrentlyPreparingBuild( project.getId()
) )
                         {
                             ProjectScmRoot scmRoot = getProjectScmRootByProject( project.getId()
);
 
@@ -3410,7 +3411,9 @@
             {
                 // check if project already in queue
                 if ( parallelBuildsManager.isInAnyBuildQueue( projectId ) ||
-                    parallelBuildsManager.isProjectInAnyCurrentBuild( projectId ) )
+                    parallelBuildsManager.isProjectInAnyCurrentBuild( projectId ) ||
+                    parallelBuildsManager.isInPrepareBuildQueue( projectId ) ||
+                    parallelBuildsManager.isProjectCurrentlyPreparingBuild( projectId ) )
                 {
                     continue;
                 }
@@ -3507,8 +3510,11 @@
             {
                 // check if project already in queue
                 if ( parallelBuildsManager.isInAnyBuildQueue( projectId ) ||
-                    parallelBuildsManager.isProjectInAnyCurrentBuild( projectId ) )
+                    parallelBuildsManager.isProjectInAnyCurrentBuild( projectId ) ||
+                    parallelBuildsManager.isInPrepareBuildQueue( projectId ) ||
+                    parallelBuildsManager.isProjectCurrentlyPreparingBuild( projectId ) )
                 {
+                    log.info( "not building" );
                     continue;
                 }
 



Mime
View raw message