Summary: | Threading issues in SystemTempFileListener | ||||||
---|---|---|---|---|---|---|---|
Product: | [Tools] Target Management | Reporter: | Martin Oberhuber <mober.at+eclipse> | ||||
Component: | RSE | Assignee: | Martin Oberhuber <mober.at+eclipse> | ||||
Status: | RESOLVED FIXED | QA Contact: | Martin Oberhuber <mober.at+eclipse> | ||||
Severity: | minor | ||||||
Priority: | P2 | CC: | javier.montalvoorus, kjdoyle, xuanchen | ||||
Version: | 2.0 | Flags: | javier.montalvoorus:
review+
|
||||
Target Milestone: | 2.0.1 | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Martin Oberhuber
2007-08-10 10:09:24 EDT
Created attachment 75845 [details]
Patch to fix threading issues
Attached patch fixes the issues:
* Declare _isSynching volatile to fix multi-thread access
* Make the synchronized(_changedResources) block smaller, by first copying
contents into a separate array then clearing the arrayList; that way, we
are sure to never call out of the synchronized block, avoiding deadlock.
* Add synchronzied(_changedResources) around the _changedResources.add()
call in order to avoid ConcurrentModificationException
* Put try ... finally block around the code between the _isSynching mutex
Patch committed: [199573] Fix potential threading issues in SystemTempFileListener SystemTempFileListener.java 1.21 Everybody please review the changes for educational purposes. It's a very typical example of how threading issues are to be avoided in Java. |