summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-11-15 07:04:00 (EST)
committerEike Stepper2007-11-15 07:04:00 (EST)
commit8b661b8f2e882bb7cc1f30f85c78a202b4d80ea1 (patch)
tree137f1f4dde3ce88804931478800415a26a7322f1
parent857e69c545d283e0b6044d8a8f2afcbe12bc410b (diff)
downloadcdo-8b661b8f2e882bb7cc1f30f85c78a202b4d80ea1.zip
cdo-8b661b8f2e882bb7cc1f30f85c78a202b4d80ea1.tar.gz
cdo-8b661b8f2e882bb7cc1f30f85c78a202b4d80ea1.tar.bz2
[209490] Put purging mechanism in CDOViewIMpl::objects to avoid OutOfMemory
https://bugs.eclipse.org/bugs/show_bug.cgi?id=209490
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java51
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java13
2 files changed, 43 insertions, 21 deletions
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 25540aa..dfc5ae2 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
@@ -25,21 +25,6 @@ import org.eclipse.emf.cdo.protocol.revision.CDORevision;
import org.eclipse.emf.cdo.protocol.util.TransportException;
import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.net4j.IChannel;
-import org.eclipse.net4j.IConnector;
-import org.eclipse.net4j.internal.util.container.Container;
-import org.eclipse.net4j.internal.util.event.Event;
-import org.eclipse.net4j.internal.util.lifecycle.LifecycleEventAdapter;
-import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
-import org.eclipse.net4j.signal.IFailOverEvent;
-import org.eclipse.net4j.signal.IFailOverStrategy;
-import org.eclipse.net4j.util.ImplementationError;
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.event.EventUtil;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.lifecycle.ILifecycle;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
@@ -56,6 +41,21 @@ import org.eclipse.emf.internal.cdo.protocol.ViewsChangedNotification;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.emf.internal.cdo.util.ProxyResolverURIResourceMap;
+import org.eclipse.net4j.IChannel;
+import org.eclipse.net4j.IConnector;
+import org.eclipse.net4j.internal.util.container.Container;
+import org.eclipse.net4j.internal.util.event.Event;
+import org.eclipse.net4j.internal.util.lifecycle.LifecycleEventAdapter;
+import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
+import org.eclipse.net4j.signal.IFailOverEvent;
+import org.eclipse.net4j.signal.IFailOverStrategy;
+import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.event.EventUtil;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.lifecycle.ILifecycle;
+
import java.text.MessageFormat;
import java.util.Collection;
import java.util.Collections;
@@ -248,11 +248,16 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
public CDOTransactionImpl openTransaction(ResourceSet resourceSet)
{
- CDOTransactionImpl transaction = new CDOTransactionImpl(++lastViewID, this);
+ CDOTransactionImpl transaction = createTransaction(++lastViewID);
attach(resourceSet, transaction);
return transaction;
}
+ protected CDOTransactionImpl createTransaction(int id)
+ {
+ return new CDOTransactionImpl(id, this);
+ }
+
public CDOTransactionImpl openTransaction()
{
return openTransaction(createResourceSet());
@@ -260,11 +265,16 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
public CDOViewImpl openView(ResourceSet resourceSet)
{
- CDOViewImpl view = new CDOViewImpl(++lastViewID, this);
+ CDOViewImpl view = createView(++lastViewID);
attach(resourceSet, view);
return view;
}
+ protected CDOViewImpl createView(int id)
+ {
+ return new CDOViewImpl(id, this);
+ }
+
public CDOViewImpl openView()
{
return openView(createResourceSet());
@@ -272,11 +282,16 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
public CDOAuditImpl openAudit(ResourceSet resourceSet, long timeStamp)
{
- CDOAuditImpl audit = new CDOAuditImpl(++lastViewID, this, timeStamp);
+ CDOAuditImpl audit = createAudit(++lastViewID, timeStamp);
attach(resourceSet, audit);
return audit;
}
+ protected CDOAuditImpl createAudit(int id, long timeStamp)
+ {
+ return new CDOAuditImpl(id, this, timeStamp);
+ }
+
public CDOAuditImpl openAudit(long timeStamp)
{
return openAudit(createResourceSet(), timeStamp);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
index 4e43a12..40cd526 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOViewImpl.java
@@ -53,14 +53,15 @@ import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
import org.eclipse.net4j.signal.IFailOverStrategy;
import org.eclipse.net4j.util.ImplementationError;
+import org.eclipse.net4j.util.ref.ReferenceValueMap;
+import org.eclipse.net4j.util.ref.ReferenceValueMap.Soft;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
/**
* @author Eike Stepper
@@ -83,7 +84,7 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
private CDOFeatureAnalyzer featureAnalyzer = CDOFeatureAnalyzer.NOOP;
- private Map<CDOID, InternalCDOObject> objects = new HashMap<CDOID, InternalCDOObject>();
+ private ConcurrentMap<CDOID, InternalCDOObject> objects;
private CDOStore store = new CDOStore(this);
@@ -97,6 +98,12 @@ public class CDOViewImpl extends org.eclipse.net4j.internal.util.event.Notifier
this.session = session;
enableInvalidationNotifications = OM.PREF_ENABLE_INVALIDATION_NOTIFICATIONS.getValue();
loadRevisionCollectionChunkSize = OM.PREF_LOAD_REVISION_COLLECTION_CHUNK_SIZE.getValue();
+ objects = createObjectsMap();
+ }
+
+ protected Soft<CDOID, InternalCDOObject> createObjectsMap()
+ {
+ return new ReferenceValueMap.Soft<CDOID, InternalCDOObject>();
}
public int getViewID()