summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-26 15:03:48 (EDT)
committerEike Stepper2007-09-26 15:03:48 (EDT)
commit487ac7f9768be7cbe8acdacf3e6debd3d7177064 (patch)
tree9629e62651ab139be588d25080db2a65005485ab
parent0fe8e458d80f162bef21e961ec027ba94f36f8da (diff)
downloadcdo-487ac7f9768be7cbe8acdacf3e6debd3d7177064.zip
cdo-487ac7f9768be7cbe8acdacf3e6debd3d7177064.tar.gz
cdo-487ac7f9768be7cbe8acdacf3e6debd3d7177064.tar.bz2
[202768] Optimize CDOIDTyped
https://bugs.eclipse.org/bugs/show_bug.cgi?id=202768
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java4
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java11
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOSessionImpl.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/LegacyObjectDisabler.java44
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java14
11 files changed, 98 insertions, 22 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index 5cd000e..cb7eaaa 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -50,6 +50,8 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
private int sessionID;
+ private boolean disableLegacyObjects;
+
private ConcurrentMap<Integer, View> views = new ConcurrentHashMap<Integer, View>();
private Set<CDOID> knownTypes = new HashSet<CDOID>();
@@ -63,7 +65,7 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
}
};
- public Session(SessionManager sessionManager, CDOServerProtocol protocol, int sessionID)
+ public Session(SessionManager sessionManager, CDOServerProtocol protocol, int sessionID, boolean disableLegacyObjects)
throws SessionCreationException
{
this.sessionManager = sessionManager;
@@ -91,6 +93,11 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
return sessionID;
}
+ public boolean isDisableLegacyObjects()
+ {
+ return disableLegacyObjects;
+ }
+
public CDOServerProtocol getProtocol()
{
return protocol;
@@ -166,7 +173,7 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
public CDOID provideCDOID(Object idObject)
{
CDOID id = (CDOID)idObject;
- if (id.isNull() || id.isMeta())
+ if (disableLegacyObjects || id.isNull() || id.isMeta())
{
return id;
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java
index 6d7a8c9..01d9f46 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/SessionManager.java
@@ -70,7 +70,7 @@ public class SessionManager extends Container<ISession> implements ISessionManag
}
}
- public Session openSession(CDOServerProtocol protocol) throws SessionCreationException
+ public Session openSession(CDOServerProtocol protocol, boolean disableLegacyObjects) throws SessionCreationException
{
int id = ++lastSessionID;
if (TRACER.isEnabled())
@@ -78,7 +78,7 @@ public class SessionManager extends Container<ISession> implements ISessionManag
TRACER.trace("Opening session " + id);
}
- Session session = new Session(this, protocol, id);
+ Session session = new Session(this, protocol, id, disableLegacyObjects);
synchronized (sessions)
{
sessions.put(id, session);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java
index 3bda346..93393ae 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/OpenSessionIndication.java
@@ -40,6 +40,8 @@ public class OpenSessionIndication extends IndicationWithResponse
private String repositoryName;
+ private boolean disableLegacyObjects;
+
public OpenSessionIndication()
{
}
@@ -54,10 +56,10 @@ public class OpenSessionIndication extends IndicationWithResponse
protected void indicating(ExtendedDataInputStream in) throws IOException
{
repositoryName = in.readString();
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Read repositoryName: {0}", repositoryName);
- }
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read repositoryName: {0}", repositoryName);
+
+ disableLegacyObjects = in.readBoolean();
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Read disableLegacyObjects: {0}", disableLegacyObjects);
}
@Override
@@ -69,7 +71,7 @@ public class OpenSessionIndication extends IndicationWithResponse
SessionManager sessionManager = repository.getSessionManager();
CDOServerProtocol serverProtocol = (CDOServerProtocol)getProtocol();
- Session session = sessionManager.openSession(serverProtocol);
+ Session session = sessionManager.openSession(serverProtocol, disableLegacyObjects);
serverProtocol.setSession(session);
writeSessionID(out, session);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java
index 0e5c0d0..692361e 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISession.java
@@ -25,6 +25,8 @@ public interface ISession extends IContainer<IView>
public int getSessionID();
+ public boolean isDisableLegacyObjects();
+
public IView[] getViews();
public IView getView(int viewID);
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java
index fe6ed41..c008ddc 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/ISessionManager.java
@@ -24,5 +24,5 @@ public interface ISessionManager extends IRepositoryElement, IContainer<ISession
/**
* @return Never <code>null</code>
*/
- public ISession openSession(CDOServerProtocol protocol) throws SessionCreationException;
+ public ISession openSession(CDOServerProtocol protocol, boolean disableLegacyObjects) throws SessionCreationException;
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
index ed0394e..fd4f9f9 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
@@ -42,7 +42,7 @@ public abstract class AbstractCDOTest extends AbstractTransportTest
protected IManagedContainer createContainer()
{
IManagedContainer container = super.createContainer();
- CDOUtil.prepareContainer(container);
+ CDOUtil.prepareContainer(container, true);
CDOServerUtil.prepareContainer(container, new ContainerRepositoryProvider(container));
CDOServerUtil.addRepository(container, createRepository());
return container;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
index 4233f63..a0c8910 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOSession.java
@@ -26,6 +26,10 @@ public interface CDOSession extends IContainer<CDOView>
{
public int getSessionID();
+ public boolean isDisableLegacyObjects();
+
+ public void setDisableLegacyObjects(boolean disableLegacyObjects);
+
public int getReferenceChunkSize();
public void setReferenceChunkSize(int referenceChunkSize);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
index f4e31fb..299c835 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
@@ -45,6 +45,7 @@ import org.eclipse.emf.internal.cdo.CDOSessionImpl;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.emf.internal.cdo.CDOViewImpl;
import org.eclipse.emf.internal.cdo.InternalCDOObject;
+import org.eclipse.emf.internal.cdo.LegacyObjectDisabler;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.protocol.CDOClientProtocolFactory;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
@@ -122,20 +123,21 @@ public final class CDOUtil
return packageTypes;
}
- public static CDOSession openSession(IConnector connector, String repositoryName, EPackage.Registry delegate,
- IFailOverStrategy failOverStrategy) throws ConnectorException
+ public static CDOSession openSession(IConnector connector, String repositoryName, boolean disableLegacyObjects,
+ EPackage.Registry delegate, IFailOverStrategy failOverStrategy) throws ConnectorException
{
CDOSessionImpl session = new CDOSessionImpl(delegate);
session.setFailOverStrategy(failOverStrategy);
session.setConnector(connector);
session.setRepositoryName(repositoryName);
+ session.setDisableLegacyObjects(disableLegacyObjects);
LifecycleUtil.activate(session);
return session;
}
public static CDOSession openSession(IConnector connector, String repositoryName) throws ConnectorException
{
- return openSession(connector, repositoryName, null, null);
+ return openSession(connector, repositoryName, false, null, null);
}
public static CDOSession openSession(IManagedContainer container, String description) throws ConnectorException
@@ -165,9 +167,10 @@ public final class CDOUtil
map.put(CDOProtocolConstants.PROTOCOL_NAME, factory);
}
- public static void prepareContainer(IManagedContainer container)
+ public static void prepareContainer(IManagedContainer container, boolean disableLegacyObjects)
{
container.registerFactory(new CDOClientProtocolFactory());
+ container.addPostProcessor(new LegacyObjectDisabler(disableLegacyObjects));
}
public static String extractResourcePath(URI uri)
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 338531d..79e38eb 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
@@ -78,6 +78,8 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
private int sessionID;
+ private boolean disableLegacyObjects;
+
private int referenceChunkSize;
private IFailOverStrategy failOverStrategy;
@@ -140,6 +142,16 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
return sessionID;
}
+ public boolean isDisableLegacyObjects()
+ {
+ return disableLegacyObjects;
+ }
+
+ public void setDisableLegacyObjects(boolean disableLegacyObjects)
+ {
+ this.disableLegacyObjects = disableLegacyObjects;
+ }
+
public int getReferenceChunkSize()
{
return referenceChunkSize;
@@ -579,7 +591,7 @@ public class CDOSessionImpl extends Container<CDOView> implements CDOSession
channel = connector.openChannel(CDOProtocolConstants.PROTOCOL_NAME, this);
}
- OpenSessionRequest request = new OpenSessionRequest(channel, repositoryName);
+ OpenSessionRequest request = new OpenSessionRequest(channel, repositoryName, disableLegacyObjects);
OpenSessionResult result = request.send();
sessionID = result.getSessionID();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/LegacyObjectDisabler.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/LegacyObjectDisabler.java
new file mode 100644
index 0000000..64c4011
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/LegacyObjectDisabler.java
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.internal.cdo;
+
+import org.eclipse.net4j.util.container.IElementProcessor;
+import org.eclipse.net4j.util.container.IManagedContainer;
+
+/**
+ * @author Eike Stepper
+ */
+public class LegacyObjectDisabler implements IElementProcessor
+{
+ private boolean disableLegacyObjects;
+
+ public LegacyObjectDisabler(boolean disableLegacyObjects)
+ {
+ this.disableLegacyObjects = disableLegacyObjects;
+ }
+
+ public LegacyObjectDisabler()
+ {
+ this(true);
+ }
+
+ public Object process(IManagedContainer container, String productGroup, String factoryType, String description,
+ Object element)
+ {
+ if (element instanceof CDOSessionImpl)
+ {
+ CDOSessionImpl session = (CDOSessionImpl)element;
+ session.setDisableLegacyObjects(disableLegacyObjects);
+ }
+
+ return element;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
index d7a302c..81975c1 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/protocol/OpenSessionRequest.java
@@ -35,10 +35,13 @@ public class OpenSessionRequest extends RequestWithConfirmation<OpenSessionResul
private String repositoryName;
- public OpenSessionRequest(IChannel channel, String repositoryName)
+ private boolean disableLegacyObjects;
+
+ public OpenSessionRequest(IChannel channel, String repositoryName, boolean disableLegacyObjects)
{
super(channel);
this.repositoryName = repositoryName;
+ this.disableLegacyObjects = disableLegacyObjects;
}
@Override
@@ -50,12 +53,11 @@ public class OpenSessionRequest extends RequestWithConfirmation<OpenSessionResul
@Override
protected void requesting(ExtendedDataOutputStream out) throws IOException
{
- if (PROTOCOL.isEnabled())
- {
- PROTOCOL.format("Writing repositoryName: {0}", repositoryName);
- }
-
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing repositoryName: {0}", repositoryName);
out.writeString(repositoryName);
+
+ if (PROTOCOL.isEnabled()) PROTOCOL.format("Writing disableLegacyObjects: {0}", disableLegacyObjects);
+ out.writeBoolean(disableLegacyObjects);
}
@Override