scala-ide/scala-ide — pull request #554 by dotta (2013-10-01 21:57:06+00:00)
Title: Issue/race condition in pc when hyperlinking between projects 1001880

Fixed race condition during presentation compiler restart.

* In the former implementation, if a request to restart the presentation
compiler was executed (concurrently) while the presentation compiler was being
initialized, the reset request could get lost. This was the reason for
flackyness of the hyperlinking test `HyperlinkDetectorTests.test1000656`.
To prove this commit fixes the issue described above, I've reverted
SHA: 35091ae.

* This new implementation guarantes that:

1) `askRestart` requests are never lost.
2) If a call to `apply` is executed *after* an `askRestart` (by the same
thread), the execution of the `apply` is guaranteed to be performed after
the presentation compiler is reinitialized.

In general, I believe it guarantees happens before semantic (see
http://en.wikipedia.org/wiki/Happened-before).

* Created a `ScalaPresentationCompilerProxy` that is responsible of handling
the presentation compiler's lifecycle. Interestingly, this new abstraction
allows for further refinements. For instance, it should be much simpler now to
add the logic for automatically shutting down a presentation compiler when it is
not being used for some time (the net effect would be to reduce the memory
footprint when a user has several opened Scala projects).

* Deleted `Cached` as it is now superseeded by `ScalaPresentationCompilerProxy`.

* Some refactoring (please, read the commit messages for details)

Fixes #1001880