From 425a4c500f41bc1578f58a60c31e3effbcdeb44c Mon Sep 17 00:00:00 2001 From: Martin Taal Date: Tue, 10 Sep 2013 07:07:24 +0200 Subject: [416530] - [Hibernate] Performance issues --- .../cdo/spi/common/revision/BaseCDORevision.java | 23 +++++++++++++++------- .../server/internal/hibernate/HibernateUtil.java | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java index e0a6853826..2e61f710d6 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/revision/BaseCDORevision.java @@ -56,9 +56,9 @@ import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.FeatureMap.Entry; import org.eclipse.emf.ecore.util.FeatureMapUtil; -import java.awt.List; import java.io.IOException; import java.text.MessageFormat; +import java.util.List; import java.util.Map; /** @@ -569,7 +569,7 @@ public abstract class BaseCDORevision extends AbstractCDORevision public void clear(EStructuralFeature feature) { - if (feature.isMany() && (flags & LIST_PRESERVING_FLAG) != 0) + if (feature.isMany() && isListPreserving()) { getList(feature).clear(); } @@ -604,7 +604,7 @@ public abstract class BaseCDORevision extends AbstractCDORevision public void unset(EStructuralFeature feature) { - if (feature.isMany() && (flags & LIST_PRESERVING_FLAG) != 0) + if (feature.isMany() && isListPreserving()) { getList(feature).clear(); } @@ -771,18 +771,27 @@ public abstract class BaseCDORevision extends AbstractCDORevision } /** - * The default behavior of a {@link BaseCDORevision} on a {@link #clear(EStructuralFeature)} and {@link #unset(EStructuralFeature)} methods is to set the efeature's value to null (discarding the value itself, a List). By calling this {@link #setListPreservingFlag()} method the default behavior is changed, instead of setting the efeature's value to null, the {@link List#clear()} method is called on the efeature's list instance. - * + * The default behavior of a {@link BaseCDORevision} on a {@link #clear(EStructuralFeature)} and + * {@link #unset(EStructuralFeature)} methods is to set the efeature's value to null (discarding the + * value itself, a List). By calling this {@link #setListPreservingFlag()} method the default behavior + * is changed, instead of setting the efeature's value to null, the {@link List#clear()} method is + * called on the efeature's list instance. + * * On purpose private to prevent api changes. - * + * * @since 4.2 */ @SuppressWarnings("unused") - private void setListPreservingFlag() + private void setListPreserving() { flags |= LIST_PRESERVING_FLAG; } + private boolean isListPreserving() + { + return (flags & LIST_PRESERVING_FLAG) != 0; + } + /** * @since 4.1 */ diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java index 3d3fa683e3..cd0b66afd3 100644 --- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java +++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java @@ -124,7 +124,7 @@ public class HibernateUtil { try { - setListPreservingFlag_Method = BaseCDORevision.class.getDeclaredMethod("setListPreservingFlag"); + setListPreservingFlag_Method = BaseCDORevision.class.getDeclaredMethod("setListPreserving"); setListPreservingFlag_Method.setAccessible(true); dataTypeFactory = DatatypeFactory.newInstance(); } -- cgit v1.2.3