http://gwt-code-reviews.appspot.com/1490801/diff/1/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java File dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java (right):
http://gwt-code-reviews.appspot.com/1490801/diff/1/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java#newcode292 dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java:292: if (unitWriter.isAlive()) { On 2011/08/01 19:38:22, jbrosenberg wrote:
I'm a little uncomfortable with using Thread.isAlive() as a state
variable
(seems prone to race conditions). For instance, here, I'm not sure if unitWriter is alive while processing a shutdownHook or not? Can you
use atomic
variables like "isStarted" and "isShuttingDown", etc.?
As we discussed offline, there is JRE help for this problem in creating a queuing mechanism that is integrated with the threading mechanism. Its a lot of churn to the file, but the logic should be pretty much intact. As far as number of lines of code goes, the change is a wash, but the fact that the queue can tell if you if the background task is active, or if a task failed at the time of submission with just a try/catch block I think makes the code more foolproof. http://gwt-code-reviews.appspot.com/1490801/diff/1/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java#newcode504 dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java:504: // This isn't 100% reliable if multiple processes are in contention On 2011/08/01 19:38:22, jbrosenberg wrote:
Could add a process specific id to the file name?
I could, but it would not be the only problem if multiple processes were trying to use the cache while things were actively changing. http://gwt-code-reviews.appspot.com/1490801/diff/5002/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java File dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java (right): http://gwt-code-reviews.appspot.com/1490801/diff/5002/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java#newcode345 dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java:345: if (shouldRotate) { Here is the essential logic change - rotate or purge the files every time cleanup is called, http://gwt-code-reviews.appspot.com/1490801/ -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
