diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java index 61d2778e2d2..2cfff460e9e 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataElement.java @@ -14,6 +14,7 @@ * Contributors: * David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed * David McKnight (IBM) - [373507] [dstore][multithread] reduce heap memory on disconnect for server + * David McKnight (IBM) - [380158] [dstore] DataStore.command() fails when multiple commands issue simultaneously *******************************************************************************/ package org.eclipse.dstore.core.model; @@ -588,20 +589,19 @@ public final class DataElement implements IDataElement */ public DataElement get(int index) { - if (_nestedData == null) - { + if (_nestedData == null){ return null; } else { - if (getNestedSize() > index) - { - Object obj = _nestedData.get(index); - return (DataElement) obj; - } - else - { - return null; + synchronized(_nestedData){ // bug 380158, sync needed to properly do concurrent commands + if (_nestedData.size() > index){ + Object obj = _nestedData.get(index); + return (DataElement) obj; + } + else { + return null; + } } } }