Author: scabanovich
Date: 2009-12-15 09:35:36 -0500 (Tue, 15 Dec 2009)
New Revision: 19278
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularChildren.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularChildren.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularChildren.java 2009-12-15
13:57:19 UTC (rev 19277)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularChildren.java 2009-12-15
14:35:36 UTC (rev 19278)
@@ -99,7 +99,9 @@
public Map<String, XModelObject> getObjectsMap() {
Map<String, XModelObject> result = new HashMap<String, XModelObject>();
if (objects != null) {
- result.putAll(objects.getMap());
+ synchronized(objects) {
+ result.putAll(objects.getMap());
+ }
}
return result;
}
@@ -246,7 +248,9 @@
}
public void put(String key, XModelObject value) {
- entries.put(key, value);
+ synchronized(entries) {
+ entries.put(key, value);
+ }
if(cache != null) {
synchronized(this) {
cache = null;
@@ -264,7 +268,9 @@
}
private XModelObject[] values() {
- return entries.values().toArray(RegularChildren.EMPTY);
+ synchronized(entries) {
+ return entries.values().toArray(RegularChildren.EMPTY);
+ }
}
/**
@@ -291,7 +297,9 @@
}
public void remove(String key) {
- entries.remove(key);
+ synchronized(entries) {
+ entries.remove(key);
+ }
if(cache != null) {
synchronized(this) {
cache = null;
@@ -306,9 +314,11 @@
*/
public int getChildrenCount(String entity) {
int k = 0;
- for (XModelObject r : entries.values()) {
- String e = r.getModelEntity().getName();
- if (entity.equals(e)) ++k;
+ synchronized(entries) {
+ for (XModelObject r : entries.values()) {
+ String e = r.getModelEntity().getName();
+ if (entity.equals(e)) ++k;
+ }
}
return k;
}