1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

[294933] [dstore] RSE goes into loop

This commit is contained in:
David McKnight 2009-11-13 13:47:57 +00:00
parent 723c8380ae
commit c6be7b244e

View file

@ -32,6 +32,7 @@
* David McKnight (IBM) - [285301] [dstore] 100% CPU if user does not have write access to $HOME * David McKnight (IBM) - [285301] [dstore] 100% CPU if user does not have write access to $HOME
* David McKnight (IBM) - [287457] [dstore] problems with disconnect when readonly trace file * David McKnight (IBM) - [287457] [dstore] problems with disconnect when readonly trace file
* David McKnight (IBM) - [289891] [dstore] StringIndexOutOfBoundsException in getUserPreferencesDirectory when DSTORE_LOG_DIRECTORY is "" * David McKnight (IBM) - [289891] [dstore] StringIndexOutOfBoundsException in getUserPreferencesDirectory when DSTORE_LOG_DIRECTORY is ""
* David McKnight (IBM) - [294933] [dstore] RSE goes into loop
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.core.model; package org.eclipse.dstore.core.model;
@ -845,8 +846,10 @@ public final class DataStore
*/ */
public int getNumElements() public int getNumElements()
{ {
synchronized (_hashMap){
return _hashMap.size(); return _hashMap.size();
} }
}
/** /**
* Returns the number of recycled elements in the <code>DataStore</code>. * Returns the number of recycled elements in the <code>DataStore</code>.
@ -923,8 +926,9 @@ public final class DataStore
parent.addNestedData(reference, false); parent.addNestedData(reference, false);
String sugId = reference.getId(); String sugId = reference.getId();
synchronized (_hashMap){
_hashMap.put(sugId, reference); _hashMap.put(sugId, reference);
}
refresh(parent); refresh(parent);
return reference; return reference;
@ -977,7 +981,9 @@ public final class DataStore
parent.addNestedData(reference, false); parent.addNestedData(reference, false);
String sugId = reference.getId(); String sugId = reference.getId();
synchronized (_hashMap){
_hashMap.put(sugId, reference); _hashMap.put(sugId, reference);
}
if (doRefresh) if (doRefresh)
{ {
@ -1049,8 +1055,9 @@ public final class DataStore
parent.addNestedData(toReference, false); parent.addNestedData(toReference, false);
String toId = toReference.getId(); String toId = toReference.getId();
synchronized (_hashMap){
_hashMap.put(toId, toReference); _hashMap.put(toId, toReference);
}
// reference with "from" relationship // reference with "from" relationship
DataElement fromReference = createElement(); DataElement fromReference = createElement();
@ -1059,7 +1066,9 @@ public final class DataStore
realObject.addNestedData(fromReference, false); realObject.addNestedData(fromReference, false);
String fromId = fromReference.getId(); String fromId = fromReference.getId();
synchronized (_hashMap){
_hashMap.put(fromId, fromReference); _hashMap.put(fromId, fromReference);
}
refresh(parent); refresh(parent);
@ -1096,7 +1105,9 @@ public final class DataStore
parent.addNestedData(toReference, false); parent.addNestedData(toReference, false);
String toId = toReference.getId(); String toId = toReference.getId();
synchronized (_hashMap){
_hashMap.put(toId, toReference); _hashMap.put(toId, toReference);
}
// reference with "from" relationship // reference with "from" relationship
DataElement fromReference = createElement(); DataElement fromReference = createElement();
@ -1114,8 +1125,9 @@ public final class DataStore
realObject.addNestedData(fromReference, false); realObject.addNestedData(fromReference, false);
String fromId = fromReference.getId(); String fromId = fromReference.getId();
synchronized (_hashMap){
_hashMap.put(fromId, fromReference); _hashMap.put(fromId, fromReference);
}
refresh(parent); refresh(parent);
@ -1830,8 +1842,10 @@ public final class DataStore
*/ */
public boolean contains(String id) public boolean contains(String id)
{ {
synchronized (_hashMap){
return _hashMap.containsKey(id); return _hashMap.containsKey(id);
} }
}
/** /**
* Refresh a set of <code>DataElement</code>s * Refresh a set of <code>DataElement</code>s
@ -3121,9 +3135,11 @@ public final class DataStore
*/ */
public DataElement find(String id) public DataElement find(String id)
{ {
synchronized (_hashMap){
DataElement result = (DataElement) _hashMap.get(id); DataElement result = (DataElement) _hashMap.get(id);
return result; return result;
} }
}
/** /**
* Finds an element matching a specified attribute and name. * Finds an element matching a specified attribute and name.
@ -3986,8 +4002,12 @@ public final class DataStore
private String makeIdUnique(String id) private String makeIdUnique(String id)
{ {
boolean containsKey = false;
synchronized (_hashMap){
containsKey = _hashMap.containsKey(id);
}
if (!_hashMap.containsKey(id)) if (!containsKey)
{ {
return id; return id;
} }
@ -4022,16 +4042,13 @@ public final class DataStore
*/ */
protected String generateId() protected String generateId()
{ {
//return "" + _uniqueNumber++;
///*
String newId = String.valueOf(_random.nextInt()); String newId = String.valueOf(_random.nextInt());
while (_hashMap.containsKey(newId)) while (contains(newId))
{ {
newId = String.valueOf(_random.nextInt()); newId = String.valueOf(_random.nextInt());
} }
return newId; return newId;
// */
} }
public void startTracing() public void startTracing()