ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles Scokart" <gscok...@gmail.com>
Subject Re: Problem when running ivy in threads
Date Tue, 06 Nov 2007 08:21:18 GMT
You might be right, but in your example, you only have a single thread.  So
it is rather a problem of file handle not closed.

Did you tried with a 2.0 version.  I think that some missing close have been
added a few months ago.

By the way, what are the difference bteween your plugin and ivyCruise?  Did
you restart from scratch or did you updated it?  I would like to make a
setup using a <ivybuilder>.  Maybe you have some usefull info.


PS: note that <thread> of cruise control only control the number of build in
parallel, but every project has his own thread used when invoking your
modification set plugin.  So, even if you set thread to 1, you will still
have your modificationset executed in multithread.

Gilles

2007/11/5, Ivan Rambius Ivanov <rambiusparkisanius@yahoo.com>:
>
> Hello,
>
> I am using Ivy 1.4.1 on Windows XP SP2. I have developed some
> CruiseControl plugins similar to ivycruise and I may contribute them to ivy
> in the future, but for now I have the following problem:
>
> My CruiseControl plugin checks the ivy repository if there is a new
> revision of a project's dependencies since the last successful build and if
> there is a new CruiseControl build is triggered. In order to check which are
> the project's dependencies, I parse (using Ivy API) the project's ivy
> descriptor. So far so good, but I noticed that some of the ivy descriptors
> get locked on Windows environment. After some debugging it turned out that
> the problem with the locked files come from the fact that we run our
> cruisecontrol builds on multiple threads, see [1].
>
> I tried the reproduce the problem with some simple test case and I
> invented the following:
>
> import java.io.File;
> import java.net.URL;
>
> import fr.jayasoft.ivy.Ivy;
> import fr.jayasoft.ivy.ModuleDescriptor;
> import fr.jayasoft.ivy.parser.ModuleDescriptorParserRegistry;
>
> public class Main {
>
>     public static void main(String[] args) throws Exception {
>         String ivyDescriptor = args[0]; // location of any ivy.xml
>         Ivy ivy = new Ivy();
>
>         ModuleDescriptorParserRegistry mdpr =
> ModuleDescriptorParserRegistry.getInstance();
>         File ivyFile = new File(ivyDescriptor);
>         URL ivyFileURL = ivyFile.toURL();
>         ModuleDescriptor md = mdpr.parseDescriptor(ivy, ivyFileURL, true);
>         System.out.println("module name is " + md.getModuleRevisionId
> ().getName());
>
>         Thread.sleep(60 * 1000);// sleep for one minute
>     }
> }
>
> After the line
>
>         ModuleDescriptor md = mdpr.parseDescriptor(ivy, ivyFileURL, true);
>
> I would expect that all the streams opened to the ivyDescriptor file
> should be closed. However, during the 1 minute thread sleep, I am not able,
> for example, to rename the file in Windows Explorer, because it says it is
> being used by another program. After one minute I can rename the file.
>
> One my hypothesis is that the Ant API is not thread-safe. Is it true or
> not and can you give me some advice on how to prevent ivy descriptors from
> being locked when I parse them with the code above?
>
> Regards
> Rambius
>
>
> [1] http://cruisecontrol.sourceforge.net/main/configxml.html#threads
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>



-- 
Gilles SCOKART

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message