ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xavier Hanin" <xavier.ha...@gmail.com>
Subject Re: Ivy, IvyDE and thread safety?
Date Fri, 25 Jul 2008 09:28:47 GMT
On Thu, Jul 24, 2008 at 5:38 PM, Nicolas Lalevée <nicolas.lalevee@hibnet.org>
wrote:

> Le jeudi 24 juillet 2008, Gilles Scokart a écrit :
> > Up to now, I think Ivy has mostly be used in a single thread.  When
> > used from ant, even if it is possible to have multiple tasks running
> > in parallel, I doubdt it has ever been extensively used.
> >
> > There is thus a risk that some part of the code are not thread safe.
> >
> > I'm wondering what is actually the risk when Ivy is used from IvyDE?
> > Does IvyDE will likely invoke Ivy from multiple thread in parallel?
>
> The IvyResolveJob of IvyDE is synchronized to be run only one at a time,
> ensured by Eclipse. So when computing the classpath of the java projects,
> there won't be any thread issue.
> But Ivy is also used for ivy file completion and ivy file parsing. I don't
> know how far the code in Eclipse can use them with multiple thread. But
> whatever, the synchronization point here will be the end user that won't be
> able to edit files threadedly. :p
> So I don't think Ivy is used in a threaded way in IvyDE.

Mmm, I think Ivy can be used in multiple threads  in IvyDE, concurrent code
completion and dependency resolution for instance. And this can be an issue,
since I can say that Ivy classes are NOT thread safe, there's no doubt about
that. There's one thing I've wondered about several times about IvyDE, is if
reusing the same Ivy instance whenever possible is acutally a good thing.
Most of the time loading settings is very quick, so creating an Ivy instance
on demand (or at least reusing it only per context of use) could make sense
(using a separate Ivy instance per thread should make thread safety issues
less likely to occur). Then we still have some points to fix, like some
(bad) singletons like the ModuleParserRegistry. We should try to track all
static methods and fields and see which of them are not delegating the
actual work to a thread local or something similar (like Messages do).

Xavier


>
> Nicolas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>


-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://ant.apache.org/ivy/
http://www.xoocode.org/

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