1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

[385793] [dstore] DataStore spirit mechanism and other memory improvements needed

This commit is contained in:
David McKnight 2012-07-25 13:51:07 +00:00
parent 0de7b7ba58
commit a769989ace
5 changed files with 42 additions and 17 deletions

View file

@ -15,6 +15,7 @@
* 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
* David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed
*******************************************************************************/
package org.eclipse.dstore.core.model;
@ -1627,11 +1628,7 @@ public final class DataElement implements IDataElement
{
for (int i = 0; i < _attributes.length; i++)
{
String att = _attributes[i];
if (att != null)
{
att = null;
}
_attributes[i] = null;
}
}

View file

@ -43,6 +43,7 @@
* David McKnight (IBM) - [370260] [dstore] log the RSE version in server traces
* David McKnight (IBM) - [373507] [dstore][multithread] reduce heap memory on disconnect for server
* David McKnight (IBM) - [385097] [dstore] DataStore spirit mechanism is not enabled
* David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed
*******************************************************************************/
package org.eclipse.dstore.core.model;
@ -2879,7 +2880,7 @@ public final class DataStore
return results;
}
if (root.isDeleted())
if (root.isDeleted() && !results.contains(root))
{
results.add(root);
}
@ -2898,7 +2899,6 @@ public final class DataStore
{
if (child.isDeleted() && !results.contains(child))
{
results.add(child);
if (!child.isReference())
{

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others.
* Copyright (c) 2002, 212 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -14,6 +14,7 @@
* Contributors:
* 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) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed
*******************************************************************************/
package org.eclipse.dstore.core.model;
@ -88,13 +89,17 @@ public abstract class UpdateHandler extends Handler
cleanChildren(child); // clean the children
boolean virtual = _dataStore.isVirtual();
if (child.isSpirit())
{
// officially delete this now
child.delete();
if (!virtual){ // leave the client copy
// officially delete this now
child.delete();
}
}
if (!virtual || !child.isSpirit()){ // leave the client attributes if spirited
child.clear();
}
child.clear();
if (parent != null)
{
synchronized (parent)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2010 IBM Corporation and others.
* Copyright (c) 2002, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -19,12 +19,14 @@
* David McKnight (IBM) - [257666] modified original patch to simplify
* Noriaki Takatsu (IBM) - [283656] [dstore][multithread] Serviceability issue
* Noriaki Takatsu (IBM) - [289234][multithread][api] Reset and Restart KeepAliveRequestThread
* David McKnight (IBM) - [385793] [dstore] DataStore spirit mechanism and other memory improvements needed
*******************************************************************************/
package org.eclipse.dstore.core.server;
import java.io.IOException;
import java.net.Socket;
import java.util.List;
import org.eclipse.dstore.core.model.DataElement;
import org.eclipse.dstore.core.util.Receiver;
@ -38,7 +40,10 @@ import org.eclipse.dstore.core.util.Receiver;
*/
public class ServerReceiver extends Receiver
{
private DataElement _log;
private int _maxLog = 20;
private int _logIndex = 0;
private ConnectionEstablisher _connection;
/**
@ -51,6 +56,7 @@ public class ServerReceiver extends Receiver
{
super(socket, connection.getDataStore());
_connection = connection;
_log = _dataStore.getLogRoot();
}
@ -67,8 +73,25 @@ public class ServerReceiver extends Receiver
{
DataElement rootOutput = documentObject.get(a);
DataElement log = _dataStore.getLogRoot();
log.addNestedData(rootOutput, false);
// max log
List logged = _log.getNestedData();
if (logged == null){
_log.addNestedData(rootOutput, false);
_logIndex++;
}
else {
if (_logIndex > _maxLog){
_logIndex = 0; // reset logindex
}
if (logged.size() > _logIndex){
logged.set(_logIndex, rootOutput);
}
else {
logged.add(_logIndex, rootOutput);
}
_logIndex++;
}
if (rootOutput.getName().equals("C_EXIT")) //$NON-NLS-1$
{

View file

@ -39,7 +39,7 @@ public class DataElementRemover extends Handler
private static int numRemoved = 0;
private static int numDisconnected = 0;
private static int numCreated = 0;
//private static int numGCed = 0;
//private int numGCed = 0;
// The following determine how DataElements are chosen to be removed once they
// are in the queue for removal.