diff options
author | Eike Stepper | 2013-05-31 17:16:32 +0000 |
---|---|---|
committer | Eike Stepper | 2013-05-31 17:16:32 +0000 |
commit | a5807c7e51c49f4823d2514679a98d4136273902 (patch) | |
tree | 40c250fab1a9ee9e2816914dd66c7924e40fd439 | |
parent | 3db23bbc4d9ecd4f0b59ba763e821dd2286252de (diff) | |
download | cdo-a5807c7e51c49f4823d2514679a98d4136273902.tar.gz cdo-a5807c7e51c49f4823d2514679a98d4136273902.tar.xz cdo-a5807c7e51c49f4823d2514679a98d4136273902.zip |
[370181] Make the lock timeouts in
TransactionCommitContext.lockObjects() configurable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=370181
7 files changed, 38 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml index c76d89e9f1..33c0dc28e6 100644 --- a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml +++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml @@ -20,6 +20,8 @@ <property name="ensureReferentialIntegrity" value="false"/> <property name="allowInterruptRunningQueries" value="true"/> <property name="idGenerationLocation" value="CLIENT"/> <!-- Possible values: STORE | CLIENT --> + <property name="serializeCommits" value="false"/> + <property name="optimisticLockingTimeout" value="10000"/> <!-- Example http://bugs.eclipse.org/380629 <securityManager type="default" realmPath="/security"/> diff --git a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml index c76d89e9f1..33c0dc28e6 100644 --- a/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml +++ b/plugins/org.eclipse.emf.cdo.examples.master/config/cdo-server.xml @@ -20,6 +20,8 @@ <property name="ensureReferentialIntegrity" value="false"/> <property name="allowInterruptRunningQueries" value="true"/> <property name="idGenerationLocation" value="CLIENT"/> <!-- Possible values: STORE | CLIENT --> + <property name="serializeCommits" value="false"/> + <property name="optimisticLockingTimeout" value="10000"/> <!-- Example http://bugs.eclipse.org/380629 <securityManager type="default" realmPath="/security"/> diff --git a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml index 652ae84cbe..00ffc9f2b6 100644 --- a/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml +++ b/plugins/org.eclipse.emf.cdo.server.product/config/cdo-server.xml @@ -20,6 +20,8 @@ <property name="ensureReferentialIntegrity" value="false"/> <property name="allowInterruptRunningQueries" value="true"/> <property name="idGenerationLocation" value="STORE"/> <!-- Possible values: STORE | CLIENT --> + <property name="serializeCommits" value="false"/> + <property name="optimisticLockingTimeout" value="10000"/> <!-- Example http://bugs.eclipse.org/380629 <securityManager type="default" realmPath="/security"/> 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 4162dd6237..b0b360f4be 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 @@ -162,6 +162,8 @@ public class Repository extends Container<Object> implements InternalRepository private IDGenerationLocation idGenerationLocation; + private long optimisticLockingTimeout = 10000L; + /** * Must not be thread-bound to support XA commits. */ @@ -347,6 +349,11 @@ public class Repository extends Container<Object> implements InternalRepository return idGenerationLocation; } + public long getOptimisticLockingTimeout() + { + return optimisticLockingTimeout; + } + public String getStoreType() { return store.getType(); @@ -1644,6 +1651,7 @@ public class Repository extends Container<Object> implements InternalRepository protected void initProperties() { + // SUPPORTING_AUDITS String valueAudits = properties.get(Props.SUPPORTING_AUDITS); if (valueAudits != null) { @@ -1654,6 +1662,7 @@ public class Repository extends Container<Object> implements InternalRepository supportingAudits = store.getRevisionTemporality() == IStore.RevisionTemporality.AUDITING; } + // SUPPORTING_BRANCHES String valueBranches = properties.get(Props.SUPPORTING_BRANCHES); if (valueBranches != null) { @@ -1664,18 +1673,21 @@ public class Repository extends Container<Object> implements InternalRepository supportingBranches = store.getRevisionParallelism() == IStore.RevisionParallelism.BRANCHING; } + // SERIALIZE_COMMITS String valueCommits = properties.get(Props.SERIALIZE_COMMITS); if (valueCommits != null) { serializingCommits = Boolean.valueOf(valueCommits); } + // ENSURE_REFERENTIAL_INTEGRITY String valueIntegrity = properties.get(Props.ENSURE_REFERENTIAL_INTEGRITY); if (valueIntegrity != null) { ensuringReferentialIntegrity = Boolean.valueOf(valueIntegrity); } + // ID_GENERATION_LOCATION String valueIDLocation = properties.get(Props.ID_GENERATION_LOCATION); if (valueIDLocation != null) { @@ -1686,6 +1698,13 @@ public class Repository extends Container<Object> implements InternalRepository { idGenerationLocation = IDGenerationLocation.STORE; } + + // ENSURE_REFERENTIAL_INTEGRITY + String valueTimeout = properties.get(Props.OPTIMISTIC_LOCKING_TIMEOUT); + if (valueTimeout != null) + { + optimisticLockingTimeout = Long.valueOf(valueTimeout); + } } public void initSystemPackages() diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java index e89ce792fb..bd58ea85cb 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java @@ -928,7 +928,8 @@ public class TransactionCommitContext implements InternalCommitContext { // First lock all objects (incl. possible ref targets). // This is a transient operation, it does not check for existance! - lockManager.lock2(LockType.WRITE, transaction, lockedObjects, 10000); + long timeout = repository.getOptimisticLockingTimeout(); + lockManager.lock2(LockType.WRITE, transaction, lockedObjects, timeout); } catch (Exception ex) { diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java index 95dbedb5b9..2c87f7acc8 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java @@ -305,5 +305,10 @@ public interface IRepository extends CDOCommonRepository, IQueryHandlerProvider, * @since 4.1 */ public static final String ID_GENERATION_LOCATION = "idGenerationLocation"; //$NON-NLS-1$ + + /** + * @since 4.2 + */ + public static final String OPTIMISTIC_LOCKING_TIMEOUT = "optimisticLockingTimeout"; //$NON-NLS-1$ } } diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java index 22f7c86085..7373999e36 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalRepository.java @@ -256,4 +256,10 @@ public interface InternalRepository extends IRepository, PackageProcessor, Packa * @since 4.1 */ public UnlockObjectsResult unlock(InternalView view, LockType type, List<CDOID> ids, boolean recursive); + + /** + * @since 4.2 + */ + public long getOptimisticLockingTimeout(); + } |