Author: maartenc
Date: Fri Feb 26 23:43:06 2010
New Revision: 916867
URL: http://svn.apache.org/viewvc?rev=916867&view=rev
Log:
FIX: artifact-lock strategy could hang Ivy when resolving dynamic revisions
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=916867&r1=916866&r2=916867&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Feb 26 23:43:06 2010
@@ -115,6 +115,7 @@
- IMPROVEMENT: Trace a message when a property file referenced from the
settings doesn't exixts (IVY-1074)
- IMPROVEMENT: use defaultconf in combination with defaultconfmapping
(IVY-1135) (thanks to Jon Schneider)
+- FIX: artifact-lock strategy could hang Ivy when resolving dynamic revisions
- FIX: Authentication won't work in some situations (IVY-1168) (thanks to Sven
Walter)
- FIX: Using SFTP resolver with full pattern URL prevents use of dynamic
versions (IVY-1167) (thanks to Gregory Fernandez)
- FIX: parent.groupId is not resolved in maven 2 parser (IVY-1169) (thanks to
Achim Huegen)
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=916867&r1=916866&r2=916867&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
Fri Feb 26 23:43:06 2010
@@ -547,13 +547,29 @@
Message.error("impossible to acquire lock for " + mrid);
return null;
}
+
+ boolean unlock = true;
+
try {
if (settings.getVersionMatcher().isDynamic(mrid)) {
String resolvedRevision = getResolvedRevision(mrid, options);
if (resolvedRevision != null) {
Message.verbose("found resolved revision in cache: "
+ mrid + " => " + resolvedRevision);
+
+ // we have found another module in the cache, make sure we
unlock
+ // the original module
+ unlockMetadataArtifact(mrid);
mrid = ModuleRevisionId.newInstance(mrid,
resolvedRevision);
+
+ // don't forget to request a lock on the new module!
+ if (!lockMetadataArtifact(mrid)) {
+ Message.error("impossible to acquire lock for " +
mrid);
+
+ // we couldn't lock the new module, so no need to
unlock it
+ unlock = false;
+ return null;
+ }
} else {
return null;
}
@@ -619,7 +635,9 @@
Message.debug("\tno ivy file in cache for " + mrid + ": tried
" + ivyFile);
}
} finally {
- unlockMetadataArtifact(mrid);
+ if (unlock) {
+ unlockMetadataArtifact(mrid);
+ }
}
return null;
}