summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-30 12:15:30 (EDT)
committerEike Stepper2007-09-30 12:15:30 (EDT)
commit14d4cb7e6115027ffe36b2060667c1a3912f3572 (patch)
tree600b6d6d9cc0d50d79fa3fbc478c42f543604654
parent2e78c66e59287b7325a44020863819ca30cbddf8 (diff)
downloadcdo-14d4cb7e6115027ffe36b2060667c1a3912f3572.zip
cdo-14d4cb7e6115027ffe36b2060667c1a3912f3572.tar.gz
cdo-14d4cb7e6115027ffe36b2060667c1a3912f3572.tar.bz2
[203538] Limit memory consumption in CDORevisionResolverImpl
https://bugs.eclipse.org/bugs/show_bug.cgi?id=203538
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java20
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java4
3 files changed, 27 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index 29e29ee..7169123 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -38,6 +38,10 @@ public class Repository extends Container<IRepositoryElement> implements IReposi
public static final String PROP_REMEMBERING_KNOWN_TYPES = "rememberingKnownTypes";
+ public static final String PROP_CURRENT_LRU_CAPACITY = "currentLRUCapacity";
+
+ public static final String PROP_REVISED_LRU_CAPACITY = "revisedLRUCapacity";
+
private static final long INITIAL_META_ID_VALUE = 1;
private String name;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
index 5077568..b16da4f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
@@ -38,6 +38,10 @@ import java.util.List;
*/
public class RevisionManager extends CDORevisionResolverImpl implements IRevisionManager
{
+ public static final String PROP_CURRENT_LRU_CAPACITY = "currentLRUCapacity";
+
+ public static final String PROP_REVISED_LRU_CAPACITY = "revisedLRUCapacity";
+
private Repository repository;
private CDOPathFeatureImpl cdoPathFeature;
@@ -239,7 +243,21 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
return revisions;
}
- private void registerObjectType(CDORevisionImpl revision)
+ @Override
+ protected void doBeforeActivate() throws Exception
+ {
+ super.doBeforeActivate();
+ setCurrentLRUCapacity(getLRUCapacity(PROP_CURRENT_LRU_CAPACITY));
+ setRevisedLRUCapacity(getLRUCapacity(PROP_REVISED_LRU_CAPACITY));
+ }
+
+ protected int getLRUCapacity(String prop)
+ {
+ String capacity = repository.getProperties().get(prop);
+ return capacity == null ? 0 : Integer.valueOf(capacity);
+ }
+
+ protected void registerObjectType(CDORevisionImpl revision)
{
CDOID id = revision.getID();
CDOClassRefImpl type = revision.getCDOClass().createClassRef();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
index 79e38eb..27c0f2c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java
@@ -597,6 +597,8 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
sessionID = result.getSessionID();
repositoryUUID = result.getRepositoryUUID();
packageManager.addPackageProxies(result.getPackageInfos());
+ packageManager.activate();
+ revisionManager.activate();
EventUtil.addListener(channel, channelListener);
}
@@ -604,6 +606,8 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
protected void doDeactivate() throws Exception
{
EventUtil.removeListener(channel, channelListener);
+ revisionManager.deactivate();
+ packageManager.deactivate();
synchronized (views)
{
for (CDOViewImpl view : getViews())