Author: scabanovich
Date: 2012-04-03 16:08:42 -0400 (Tue, 03 Apr 2012)
New Revision: 40015
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java
Log:
JBIDE-11451
https://issues.jboss.org/browse/JBIDE-11451
Method Libs.update() should not be called in synchronized block. It is safe to be run in
concurrent threads.
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java 2012-04-03
19:47:32 UTC (rev 40014)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ext/AbstractClassPathMonitor.java 2012-04-03
20:08:42 UTC (rev 40015)
@@ -65,27 +65,29 @@
* Otherwise, updates inner model and disables class loader.
* @return
*/
- public synchronized boolean update() {
+ public boolean update() {
Libs libs = FileSystemsHelper.getLibs(model);
if(libs == null) {
return false;
}
libs.update();
- List<String> newPaths = libs.getPaths();
- boolean result = libsModified || !loaded;
- if(newPaths != null) {
- paths = newPaths;
- loaded = true;
- } else {
- paths = new ArrayList<String>();
- loaded = false;
+ synchronized(this) {
+ List<String> newPaths = libs.getPaths();
+ boolean result = libsModified || !loaded;
+ if(newPaths != null) {
+ paths = newPaths;
+ loaded = true;
+ } else {
+ paths = new ArrayList<String>();
+ loaded = false;
+ }
+ if(result) {
+ paths2.clear();
+ paths2.putAll(libs.getPathsAsMap());
+ }
+ libsModified = false;
+ return result;
}
- if(result) {
- paths2.clear();
- paths2.putAll(libs.getPathsAsMap());
- }
- libsModified = false;
- return result;
}
public void pathLoaded(IPath path) {