continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1162345 - in /continuum/trunk: continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/ continuum-release/src/main/java/org/apache/maven/continuum/release/
Date Sat, 27 Aug 2011 13:25:53 GMT
Author: ctan
Date: Sat Aug 27 13:25:52 2011
New Revision: 1162345

URL: http://svn.apache.org/viewvc?rev=1162345&view=rev
Log:
[CONTINUUM-2663] make the releaseId unique

Modified:
    continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
    continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java

Modified: continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java?rev=1162345&r1=1162344&r2=1162345&view=diff
==============================================================================
--- continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
(original)
+++ continuum/trunk/continuum-core/src/main/java/org/apache/continuum/release/distributed/manager/DefaultDistributedReleaseManager.java
Sat Aug 27 13:25:52 2011
@@ -542,11 +542,11 @@ public class DefaultDistributedReleaseMa
         {
             if ( distributedBuildManager.isAgentAvailable( buildAgentUrl ) )
             {
-                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
buildAgentUrl );
-                String result = client.releaseCleanup( releaseId );
-    
                 removeFromReleaseInProgress( releaseId );
                 removeFromPreparedReleases( releaseId );
+
+                SlaveBuildAgentTransportService client = createSlaveBuildAgentTransportClientConnection(
buildAgentUrl );
+                String result = client.releaseCleanup( releaseId );
     
                 return result;
             }
@@ -740,22 +740,16 @@ public class DefaultDistributedReleaseMa
             preparedReleases = new ArrayList<PreparedRelease>();
         }
 
-        boolean found = false;
-
         for ( PreparedRelease preparedRelease : preparedReleases )
         {
-            if ( preparedRelease.getReleaseId().equals( release.getReleaseId() ) &&
-                 preparedRelease.getReleaseName().equals( release.getReleaseName() ) )
+            if ( preparedRelease.getReleaseId().equals( release.getReleaseId() ) )
             {
-                preparedRelease.setBuildAgentUrl( release.getBuildAgentUrl() );
-                found = true;
+                preparedReleases.remove( preparedRelease );
+                break;
             }
         }
 
-        if ( !found )
-        {
-            preparedReleases.add( release );
-        }
+        preparedReleases.add( release );
 
         savePreparedReleases( preparedReleases );
     }

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java?rev=1162345&r1=1162344&r2=1162345&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
(original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
Sat Aug 27 13:25:52 2011
@@ -134,6 +134,7 @@ public class DefaultContinuumReleaseMana
         throws ContinuumReleaseException
     {
         String releaseId = project.getGroupId() + ":" + project.getArtifactId();
+        String id = releaseId;
 
         ReleaseDescriptor descriptor =
             getReleaseDescriptor( project, releaseProperties, relVersions, devVersions, environments,
workingDirectory,
@@ -145,6 +146,12 @@ public class DefaultContinuumReleaseMana
             listener.setUsername( releaseProperties.getProperty( "release-by" ) );
         }
 
+        // check if releaseId exists
+        while ( getListeners().get( releaseId ) != null )
+        {
+            releaseId = id + ":" + String.valueOf( System.currentTimeMillis() );
+        }
+
         getListeners().put( releaseId, listener );
 
         try



Mime
View raw message