Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-01-10 10:17:36 +0000
committerEike Stepper2016-01-12 07:00:02 +0000
commitc523e8929ec6285254f381732604edf5d32bc294 (patch)
tree4ea9b9b7f175f3ccd11af658f05780e964ff6a68
parent9179b45a72a36536686f603bbfef284550302d28 (diff)
downloadcdo-c523e8929ec6285254f381732604edf5d32bc294.tar.gz
cdo-c523e8929ec6285254f381732604edf5d32bc294.tar.xz
cdo-c523e8929ec6285254f381732604edf5d32bc294.zip
[485490] CDOAutoLocker: Provide a ForSingleValuedChanges subclass
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485490
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOAutoLocker.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOAutoLocker.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOAutoLocker.java
index bfe53db970..d82afed159 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOAutoLocker.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOAutoLocker.java
@@ -15,6 +15,9 @@ import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.spi.cdo.CDOMergingConflictResolver;
+
import java.util.concurrent.TimeoutException;
/**
@@ -50,4 +53,35 @@ public class CDOAutoLocker extends CDODefaultTransactionHandler1
throw WrappedException.wrap(ex);
}
}
+
+ /**
+ * An {@link CDOAutoLocker auto locker} that only locks objects when their single-valued features are changed.
+ * <p>
+ * This auto locker is useful in combination with a {@link CDOTransaction.Options#addConflictResolver(CDOConflictResolver) conflict resolver}
+ * that is able to automatically resolve possible conflicts in many-valued features, such as {@link CDOMergingConflictResolver}.
+ *
+ * @author Eike Stepper
+ * @since 4.5
+ */
+ public static class ForSingleValuedChanges extends CDOAutoLocker
+ {
+ public ForSingleValuedChanges()
+ {
+ }
+
+ public ForSingleValuedChanges(long timeout)
+ {
+ super(timeout);
+ }
+
+ @Override
+ public void modifyingObject(CDOTransaction transaction, CDOObject object, CDOFeatureDelta featureChange)
+ {
+ EStructuralFeature feature = featureChange.getFeature();
+ if (!feature.isMany())
+ {
+ super.modifyingObject(transaction, object, featureChange);
+ }
+ }
+ }
}

Back to the top