1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 19:35:36 +02:00

[389286] [dstore] element delete should not clear _attributes since elements get recycled

This commit is contained in:
David McKnight 2012-09-12 18:54:29 +00:00
parent 21408f6fe9
commit 06d7cb98da
2 changed files with 19 additions and 14 deletions

View file

@ -16,6 +16,7 @@
* David McKnight (IBM) - [373507] [dstore][multithread] reduce heap memory on disconnect for server * 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 * David McKnight (IBM) - [380158] [dstore] DataStore.command() fails when multiple commands issue simultaneously
* David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed * David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed
* David McKnight (IBM) - [389286] [dstore] element delete should not clear _attributes since elements get recycled
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.core.model; package org.eclipse.dstore.core.model;
@ -336,7 +337,7 @@ public final class DataElement implements IDataElement
*/ */
public boolean isDeleted() public boolean isDeleted()
{ {
if (_attributes == null) if (_attributes == null || _attributes[0] == null || _attributes[0] == "") //$NON-NLS-1$
{ {
return true; return true;
} }
@ -1556,6 +1557,7 @@ public final class DataElement implements IDataElement
private void initialize(DataElement typeDescriptor) private void initialize(DataElement typeDescriptor)
{ {
getAttributes(); // make sure attributes is not null
_isReference = false; _isReference = false;
_isDescriptor = false; _isDescriptor = false;
_depth = 1; _depth = 1;
@ -1565,7 +1567,6 @@ public final class DataElement implements IDataElement
_isUpdated = false; _isUpdated = false;
_descriptor = typeDescriptor; _descriptor = typeDescriptor;
String depthStr = getAttribute(DE.A_DEPTH); String depthStr = getAttribute(DE.A_DEPTH);
if (depthStr != null && depthStr.length() > 0) if (depthStr != null && depthStr.length() > 0)
{ {
@ -1604,6 +1605,7 @@ public final class DataElement implements IDataElement
} }
String type = getAttribute(DE.A_TYPE); String type = getAttribute(DE.A_TYPE);
if (type != null){
if (type.equals(DE.T_OBJECT_DESCRIPTOR) if (type.equals(DE.T_OBJECT_DESCRIPTOR)
|| type.equals(DE.T_COMMAND_DESCRIPTOR) || type.equals(DE.T_COMMAND_DESCRIPTOR)
|| type.equals(DE.T_RELATION_DESCRIPTOR) || type.equals(DE.T_RELATION_DESCRIPTOR)
@ -1613,6 +1615,7 @@ public final class DataElement implements IDataElement
{ {
_isDescriptor = true; _isDescriptor = true;
} }
}
if (_nestedData != null) if (_nestedData != null)
_nestedData.clear(); _nestedData.clear();
@ -1628,9 +1631,9 @@ public final class DataElement implements IDataElement
{ {
for (int i = 0; i < _attributes.length; i++) for (int i = 0; i < _attributes.length; i++)
{ {
_attributes[i] = null; _attributes[i] = ""; //$NON-NLS-1$
} }
_attributes = null; // do not delete _attributes, since we recycle elements
} }
if (_nestedData != null) if (_nestedData != null)

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 212 IBM Corporation and others. * Copyright (c) 2002, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -15,6 +15,7 @@
* David McKnight (IBM) [202822] should not be synchronizing on clean method * David McKnight (IBM) [202822] should not be synchronizing on clean method
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed * David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
* David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed * David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed
* David McKnight (IBM) - [389286] [dstore] element delete should not clear _attributes since elements get recycled
*******************************************************************************/ *******************************************************************************/
package org.eclipse.dstore.core.model; package org.eclipse.dstore.core.model;
@ -127,11 +128,12 @@ public abstract class UpdateHandler extends Handler
List nestedData = parent.getNestedData(); List nestedData = parent.getNestedData();
if (nestedData != null) if (nestedData != null)
{ {
boolean isVirtual = parent.getDataStore().isVirtual();
for (int i = 0; i < nestedData.size(); i++){ for (int i = 0; i < nestedData.size(); i++){
DataElement child = (DataElement)nestedData.get(i); DataElement child = (DataElement)nestedData.get(i);
cleanChildren(child); cleanChildren(child);
if (child.isSpirit()) if (!isVirtual && child.isSpirit())
{ {
// officially delete this now // officially delete this now
child.delete(); child.delete();