Author: bobtarling
Date: 2007-09-24 11:33:24-0700
New Revision: 13581
Modified:
trunk/src_new/org/argouml/kernel/MemberList.java
Log:
Synchronize methods to prevent thread issues ruring load of a project
Modified: trunk/src_new/org/argouml/kernel/MemberList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/MemberList.java?view=diff&rev=13581&p1=trunk/src_new/org/argouml/kernel/MemberList.java&p2=trunk/src_new/org/argouml/kernel/MemberList.java&r1=13580&r2=13581
==============================================================================
--- trunk/src_new/org/argouml/kernel/MemberList.java (original)
+++ trunk/src_new/org/argouml/kernel/MemberList.java 2007-09-24 11:33:24-0700
@@ -70,7 +70,7 @@
LOG.info("Creating a member list");
}
- public boolean add(Object member) {
+ synchronized public boolean add(Object member) {
if (member instanceof ProjectMemberModel) {
// Always put the model at the top
@@ -87,7 +87,7 @@
return false;
}
- public boolean remove(Object member) {
+ synchronized public boolean remove(Object member) {
LOG.info("Removing a member");
if (member instanceof Diagram) {
return removeDiagram((Diagram) member);
@@ -109,7 +109,7 @@
}
}
- public Iterator iterator() {
+ synchronized public Iterator iterator() {
List temp = new ArrayList(size());
if (model != null) {
temp.add(model);
@@ -121,7 +121,7 @@
return temp.iterator();
}
- public ListIterator listIterator() {
+ synchronized public ListIterator listIterator() {
List temp = new ArrayList(size());
if (model != null) {
temp.add(model);
@@ -133,7 +133,7 @@
return temp.listIterator();
}
- public ListIterator listIterator(int arg0) {
+ synchronized public ListIterator listIterator(int arg0) {
List temp = new ArrayList(size());
if (model != null) {
temp.add(model);
@@ -160,7 +160,7 @@
return false;
}
- public int size() {
+ synchronized public int size() {
int size = diagramMembers.size();
if (model != null) {
++size;
@@ -171,7 +171,7 @@
return size;
}
- public boolean contains(Object member) {
+ synchronized public boolean contains(Object member) {
if (todoList == member) {
return true;
}
@@ -181,7 +181,7 @@
return diagramMembers.contains(member);
}
- public void clear() {
+ synchronized public void clear() {
LOG.info("Clearing members");
if (model != null) {
model.remove();
@@ -200,7 +200,7 @@
* @param type the type of the member
* @return the member of the project
*/
- public ProjectMember getMember(Class type) {
+ synchronized public ProjectMember getMember(Class type) {
if (type == ProjectMemberModel.class) {
return model;
}
@@ -215,7 +215,7 @@
* @param type the type of the member
* @return the member of the project
*/
- public List getMembers(Class type) {
+ synchronized public List getMembers(Class type) {
if (type == ProjectMemberModel.class) {
List temp = new ArrayList(1);
temp.add(model);
@@ -233,7 +233,7 @@
"There is no single instance of a " + type.getName() + " member");
}
- public Object get(int i) {
+ synchronized public Object get(int i) {
if (model != null) {
if (i == 0) {
return model;
@@ -248,11 +248,11 @@
return diagramMembers.get(i);
}
- public boolean isEmpty() {
+ synchronized public boolean isEmpty() {
return size() == 0;
}
- public Object[] toArray() {
+ synchronized public Object[] toArray() {
Object[] temp = new Object[size()];
int pos = 0;
if (model != null) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.