diff options
author | Caspar De Groot | 2011-09-21 11:08:31 +0000 |
---|---|---|
committer | Caspar De Groot | 2011-09-21 11:08:31 +0000 |
commit | b5b5efbb6a9b52633d7c16507658cdad719d8d92 (patch) | |
tree | bdbd5afb0dd9bad116aa54e630580e4c28a1dbb5 | |
parent | 68ca5b2805b4fb8669a8cc079de9e3bd6f31b88d (diff) | |
download | cdo-b5b5efbb6a9b52633d7c16507658cdad719d8d92.tar.gz cdo-b5b5efbb6a9b52633d7c16507658cdad719d8d92.tar.xz cdo-b5b5efbb6a9b52633d7c16507658cdad719d8d92.zip |
[354454] Recursive locking (tree locking)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=354454
21 files changed, 293 insertions, 97 deletions
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java index c1c0f0a5fa..0928603ce5 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CDOClientProtocol.java @@ -232,18 +232,18 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO revisionKeys.add(rev); } - return lockObjects2(revisionKeys, viewID, viewedBranch, lockType, timeout); + return lockObjects2(revisionKeys, viewID, viewedBranch, lockType, false, timeout); } public LockObjectsResult lockObjects2(List<CDORevisionKey> revisionKeys, int viewID, CDOBranch viewedBranch, - LockType lockType, long timeout) throws InterruptedException + LockType lockType, boolean recursive, long timeout) throws InterruptedException { InterruptedException interruptedException = null; RuntimeException runtimeException = null; try { - return new LockObjectsRequest(this, revisionKeys, viewID, lockType, timeout).send(); + return new LockObjectsRequest(this, revisionKeys, viewID, lockType, recursive, timeout).send(); } catch (RemoteException ex) { @@ -274,14 +274,15 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO } public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> revisionKeys, - CDOBranch viewedBranch, LockType lockType, long timeout) throws InterruptedException + CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout) throws InterruptedException { InterruptedException interruptedException = null; RuntimeException runtimeException = null; try { - return new LockDelegationRequest(this, lockAreaID, revisionKeys, viewedBranch, lockType, timeout).send(); + return new LockDelegationRequest(this, lockAreaID, revisionKeys, viewedBranch, lockType, recursive, timeout) + .send(); } catch (RemoteException ex) { @@ -311,19 +312,22 @@ public class CDOClientProtocol extends SignalProtocol<CDOSession> implements CDO throw runtimeException; } + @Deprecated public void unlockObjects(CDOView view, Collection<CDOID> objectIDs, LockType lockType) { - send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType)); + send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType, false)); } - public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType) + public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive) { - return send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType)); + return send(new UnlockObjectsRequest(this, view.getViewID(), objectIDs, lockType, recursive)); } - public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType) + public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive) { - return send(new UnlockDelegationRequest(this, lockAreaID, objectIDs, lockType)); + return send(new UnlockDelegationRequest(this, lockAreaID, objectIDs, lockType, recursive)); } public boolean isObjectLocked(CDOView view, CDOObject object, LockType lockType, boolean byOthers) diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java index 0eb364bccf..eec9004545 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockDelegationRequest.java @@ -30,9 +30,9 @@ public class LockDelegationRequest extends LockObjectsRequest private CDOBranch viewedBranch; public LockDelegationRequest(CDOClientProtocol protocol, String lockAreaID, List<CDORevisionKey> revisionKeys, - CDOBranch viewedBranch, LockType lockType, long timeout) + CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout) { - super(protocol, CDOProtocolConstants.SIGNAL_LOCK_DELEGATION, revisionKeys, 0, lockType, timeout); + super(protocol, CDOProtocolConstants.SIGNAL_LOCK_DELEGATION, revisionKeys, 0, lockType, recursive, timeout); this.lockAreaID = lockAreaID; this.viewedBranch = viewedBranch; } diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java index 21e4737504..5977d1716c 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LockObjectsRequest.java @@ -38,14 +38,16 @@ public class LockObjectsRequest extends CDOClientRequest<LockObjectsResult> private List<CDORevisionKey> revisionKeys; + private boolean recursive; + public LockObjectsRequest(CDOClientProtocol protocol, List<CDORevisionKey> revisionKeys, int viewID, - LockType lockType, long timeout) + LockType lockType, boolean recursive, long timeout) { - this(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, revisionKeys, viewID, lockType, timeout); + this(protocol, CDOProtocolConstants.SIGNAL_LOCK_OBJECTS, revisionKeys, viewID, lockType, recursive, timeout); } protected LockObjectsRequest(CDOClientProtocol protocol, short signalID, List<CDORevisionKey> revisionKeys, - int viewID, LockType lockType, long timeout) + int viewID, LockType lockType, boolean recursive, long timeout) { super(protocol, signalID); @@ -53,6 +55,7 @@ public class LockObjectsRequest extends CDOClientRequest<LockObjectsResult> this.lockType = lockType; this.timeout = timeout; this.revisionKeys = revisionKeys; + this.recursive = recursive; } @Override @@ -60,6 +63,7 @@ public class LockObjectsRequest extends CDOClientRequest<LockObjectsResult> { out.writeInt(viewID); out.writeCDOLockType(lockType); + out.writeBoolean(recursive); out.writeLong(timeout); out.writeInt(revisionKeys.size()); diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java index 3e2307fae8..b5b457de14 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockDelegationRequest.java @@ -27,9 +27,9 @@ public class UnlockDelegationRequest extends UnlockObjectsRequest private String lockAreaID; public UnlockDelegationRequest(CDOClientProtocol protocol, String lockAreaID, Collection<CDOID> objectIDs, - LockType lockType) + LockType lockType, boolean recursive) { - super(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_DELEGATION, 0, objectIDs, lockType); + super(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_DELEGATION, 0, objectIDs, lockType, recursive); this.lockAreaID = lockAreaID; } diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java index b0f021b8c5..21a3825ca8 100644 --- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java +++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/UnlockObjectsRequest.java @@ -38,18 +38,22 @@ public class UnlockObjectsRequest extends CDOClientRequest<UnlockObjectsResult> private LockType lockType; - public UnlockObjectsRequest(CDOClientProtocol protocol, int viewID, Collection<CDOID> objects, LockType lockType) + private boolean recursive; + + public UnlockObjectsRequest(CDOClientProtocol protocol, int viewID, Collection<CDOID> objects, LockType lockType, + boolean recursive) { - this(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_OBJECTS, viewID, objects, lockType); + this(protocol, CDOProtocolConstants.SIGNAL_UNLOCK_OBJECTS, viewID, objects, lockType, recursive); } protected UnlockObjectsRequest(CDOClientProtocol protocol, short signalID, int viewID, Collection<CDOID> objectIDs, - LockType lockType) + LockType lockType, boolean recursive) { super(protocol, signalID); this.viewID = viewID; this.objectIDs = objectIDs; this.lockType = lockType; + this.recursive = recursive; } @Override @@ -57,6 +61,7 @@ public class UnlockObjectsRequest extends CDOClientRequest<UnlockObjectsResult> { out.writeInt(viewID); out.writeCDOLockType(lockType); + out.writeBoolean(recursive); if (objectIDs == null) { if (TRACER.isEnabled()) diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java index e3d3924838..ef2725431b 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockObjectsIndication.java @@ -51,6 +51,7 @@ public class LockObjectsIndication extends CDOServerWriteIndication { int viewID = in.readInt(); LockType lockType = in.readCDOLockType(); + boolean recursive = in.readBoolean(); long timeout = in.readLong(); int nRevisions = in.readInt(); @@ -62,7 +63,7 @@ public class LockObjectsIndication extends CDOServerWriteIndication InternalRepository repository = getRepository(); IView view = getView(viewID); - result = repository.lock((InternalView)view, lockType, revisionKeys, timeout); + result = repository.lock((InternalView)view, lockType, revisionKeys, recursive, timeout); } protected IView getView(int viewID) diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java index c23f050142..56af52fd0f 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/UnlockObjectsIndication.java @@ -50,6 +50,7 @@ public class UnlockObjectsIndication extends CDOServerWriteIndication { int viewID = in.readInt(); LockType lockType = in.readCDOLockType(); + boolean recursive = in.readBoolean(); int size = in.readInt(); InternalRepository repository = getRepository(); @@ -57,7 +58,7 @@ public class UnlockObjectsIndication extends CDOServerWriteIndication if (size == CDOProtocolConstants.RELEASE_ALL_LOCKS) { - result = repository.unlock((InternalView)view, null, null); + result = repository.unlock((InternalView)view, null, null, false); } else { @@ -67,7 +68,7 @@ public class UnlockObjectsIndication extends CDOServerWriteIndication objectIDs.add(in.readCDOID()); } - result = repository.unlock((InternalView)view, lockType, objectIDs); + result = repository.unlock((InternalView)view, lockType, objectIDs, recursive); } } diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java index 86af31023d..50a918098c 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/LockManager.java @@ -12,6 +12,7 @@ */ package org.eclipse.emf.cdo.internal.server; +import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.cdo.common.CDOCommonView; import org.eclipse.emf.cdo.common.branch.CDOBranch; import org.eclipse.emf.cdo.common.branch.CDOBranchPoint; @@ -19,6 +20,7 @@ import org.eclipse.emf.cdo.common.id.CDOID; import org.eclipse.emf.cdo.common.id.CDOIDUtil; import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch; import org.eclipse.emf.cdo.common.revision.CDORevision; +import org.eclipse.emf.cdo.server.CDOServerUtil; import org.eclipse.emf.cdo.server.IRepository; import org.eclipse.emf.cdo.server.ISession; import org.eclipse.emf.cdo.server.ISessionManager; @@ -32,6 +34,8 @@ import org.eclipse.emf.cdo.spi.server.InternalLockManager; import org.eclipse.emf.cdo.spi.server.InternalRepository; import org.eclipse.emf.cdo.spi.server.InternalStore; import org.eclipse.emf.cdo.spi.server.InternalView; +import org.eclipse.emf.cdo.util.CDOUtil; +import org.eclipse.emf.cdo.view.CDOView; import org.eclipse.net4j.util.CheckUtil; import org.eclipse.net4j.util.ImplementationError; @@ -45,13 +49,18 @@ import org.eclipse.net4j.util.lifecycle.ILifecycle; import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter; import org.eclipse.net4j.util.options.IOptionsContainer; +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.ecore.EObject; + import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; /** * @author Simon McDuff @@ -166,11 +175,11 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern public void lock(boolean explicit, LockType type, IView view, Collection<? extends Object> objectsToLock, long timeout) throws InterruptedException { - lock2(explicit, type, view, objectsToLock, timeout); + lock2(explicit, type, view, objectsToLock, false, timeout); } public List<LockState<Object, IView>> lock2(boolean explicit, LockType type, IView view, - Collection<? extends Object> objectsToLock, long timeout) throws InterruptedException + Collection<? extends Object> objectsToLock, boolean recursive, long timeout) throws InterruptedException { String durableLockingID = null; DurableLocking accessor = null; @@ -184,7 +193,24 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern } } - List<LockState<Object, IView>> newLockStates = super.lock2(type, view, objectsToLock, timeout); + long startTime = timeout == WAIT ? 0L : currentTimeMillis(); + + List<LockState<Object, IView>> newLockStates; + synchronized (this) + { + if (recursive) + { + objectsToLock = createContentSet(objectsToLock, view); + } + + // Adjust timeout for delay we may have incurred on entering this synchronized block + if (timeout != WAIT) + { + timeout -= currentTimeMillis() - startTime; + } + + newLockStates = super.lock2(type, view, objectsToLock, timeout); + } if (accessor != null) { @@ -194,17 +220,70 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern return newLockStates; } + private Set<? extends Object> createContentSet(Collection<? extends Object> objectsToLock, IView view) + { + CDOBranch branch = view.getBranch(); + CDOView cdoView = CDOServerUtil.openView(view.getSession(), branch.getHead(), true); + + Set<Object> contents = new HashSet<Object>(); + for (Object o : objectsToLock) + { + contents.add(o); + + boolean isIDandBranch = o instanceof CDOIDAndBranch; + CDOID id; + if (isIDandBranch) + { + id = ((CDOIDAndBranch)o).getID(); + } + else + { + id = (CDOID)o; + } + + CDOObject obj = cdoView.getObject(id); + TreeIterator<EObject> iter = obj.eAllContents(); + while (iter.hasNext()) + { + EObject eObj = iter.next(); + CDOObject cdoObj = CDOUtil.getCDOObject(eObj); + CDOID childID = cdoObj.cdoID(); + Object child; + if (isIDandBranch) + { + child = CDOIDUtil.createIDAndBranch(childID, branch); + } + else + { + child = childID; + } + contents.add(child); + } + } + + return contents; + } + @Deprecated public synchronized void unlock(boolean explicit, LockType type, IView view, Collection<? extends Object> objectsToUnlock) { - unlock2(explicit, type, view, objectsToUnlock); + unlock2(explicit, type, view, objectsToUnlock, false); } public synchronized List<LockState<Object, IView>> unlock2(boolean explicit, LockType type, IView view, - Collection<? extends Object> objectsToUnlock) + Collection<? extends Object> objects, boolean recursive) { - List<LockState<Object, IView>> newLockStates = super.unlock2(type, view, objectsToUnlock); + List<LockState<Object, IView>> newLockStates; + synchronized (this) + { + if (recursive) + { + objects = createContentSet(objects, view); + } + + newLockStates = super.unlock2(type, view, objects); + } if (explicit) { @@ -212,7 +291,7 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern if (durableLockingID != null) { DurableLocking accessor = getDurableLocking(); - accessor.unlock(durableLockingID, type, objectsToUnlock); + accessor.unlock(durableLockingID, type, objects); } } @@ -222,7 +301,7 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern @Deprecated public synchronized void unlock(boolean explicit, IView view) { - unlock(explicit, view); + unlock2(explicit, view); } public synchronized List<LockState<Object, IView>> unlock2(boolean explicit, IView view) @@ -589,7 +668,7 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern { view = durableViews.get(lockAreaID); } - + return view; } @@ -601,7 +680,7 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern { unlock2(view); } - + if (view == null) { view = new DurableView(durableLockingID); @@ -660,7 +739,7 @@ public class LockManager extends RWOLockManager<Object, IView> implements Intern } } } - + return grade; } 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 1fc414d07c..4798681ef1 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 @@ -1366,19 +1366,20 @@ public class Repository extends Container<Object> implements InternalRepository return lockables; } - public LockObjectsResult lock(InternalView view, LockType lockType, List<CDORevisionKey> revKeys, long timeout) + public LockObjectsResult lock(InternalView view, LockType lockType, List<CDORevisionKey> revKeys, boolean recursive, + long timeout) { List<Object> lockables = revisionKeysToObjects(revKeys, view.getBranch(), isSupportingBranches()); - return lock(view, lockType, lockables, revKeys, timeout); + return lock(view, lockType, lockables, revKeys, recursive, timeout); } protected LockObjectsResult lock(InternalView view, LockType type, List<Object> lockables, - List<CDORevisionKey> loadedRevs, long timeout) + List<CDORevisionKey> loadedRevs, boolean recursive, long timeout) { List<LockState<Object, IView>> newLockStates = null; try { - newLockStates = lockManager.lock2(true, type, view, lockables, timeout); + newLockStates = lockManager.lock2(true, type, view, lockables, recursive, timeout); } catch (TimeoutRuntimeException ex) { @@ -1390,7 +1391,17 @@ public class Repository extends Container<Object> implements InternalRepository } long[] requiredTimestamp = { 0L }; - CDORevisionKey[] staleRevisionsArray = checkStaleRevisions(view, loadedRevs, lockables, type, requiredTimestamp); + CDORevisionKey[] staleRevisionsArray = null; + + try + { + staleRevisionsArray = checkStaleRevisions(view, loadedRevs, lockables, type, requiredTimestamp); + } + catch (IllegalArgumentException e) + { + lockManager.unlock2(true, type, view, lockables, recursive); + throw e; + } // If some of the clients' revisions are stale and it has passiveUpdates disabled, // then the locks are useless so we release them and report the stale revisions @@ -1399,7 +1410,7 @@ public class Repository extends Container<Object> implements InternalRepository boolean staleNoUpdate = staleRevisionsArray.length > 0 && !session.isPassiveUpdateEnabled(); if (staleNoUpdate) { - lockManager.unlock2(true, type, view, lockables); + lockManager.unlock2(true, type, view, lockables, recursive); return new LockObjectsResult(false, false, false, requiredTimestamp[0], staleRevisionsArray, new CDOLockState[0], getTimeStamp()); } @@ -1428,7 +1439,6 @@ public class Repository extends Container<Object> implements InternalRepository if (rev == null) { - lockManager.unlock2(true, lockType, view, objectsToLock); throw new IllegalArgumentException(String.format("Object %s not found in branch %s (possibly detached)", id, viewedBranch)); } @@ -1472,7 +1482,7 @@ public class Repository extends Container<Object> implements InternalRepository return cdoLockStates; } - public UnlockObjectsResult unlock(InternalView view, LockType lockType, List<CDOID> objectIDs) + public UnlockObjectsResult unlock(InternalView view, LockType lockType, List<CDOID> objectIDs, boolean recursive) { List<Object> unlockables = null; if (objectIDs != null) @@ -1486,10 +1496,11 @@ public class Repository extends Container<Object> implements InternalRepository } } - return doUnlock(view, lockType, unlockables); + return doUnlock(view, lockType, unlockables, recursive); } - protected UnlockObjectsResult doUnlock(InternalView view, LockType lockType, List<Object> unlockables) + protected UnlockObjectsResult doUnlock(InternalView view, LockType lockType, List<Object> unlockables, + boolean recursive) { List<LockState<Object, IView>> newLockStates = null; if (lockType == null) // Signals an unlock-all operation @@ -1498,7 +1509,7 @@ public class Repository extends Container<Object> implements InternalRepository } else { - newLockStates = lockManager.unlock2(true, lockType, view, unlockables); + newLockStates = lockManager.unlock2(true, lockType, view, unlockables, recursive); } long timestamp = getTimeStamp(); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java index 905ba5ea83..4a595ca14b 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/ServerCDOView.java @@ -155,11 +155,22 @@ public class ServerCDOView extends AbstractCDOView implements org.eclipse.emf.cd throw new UnsupportedOperationException(); } + public void lockObjects(Collection<? extends CDOObject> objects, LockType lockType, long timeout, boolean recursive) + throws InterruptedException + { + throw new UnsupportedOperationException(); + } + public void unlockObjects(Collection<? extends CDOObject> objects, LockType lockType) { throw new UnsupportedOperationException(); } + public void unlockObjects(Collection<? extends CDOObject> objects, LockType lockType, boolean recursive) + { + throw new UnsupportedOperationException(); + } + public void unlockObjects() { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java index 2a0b21ffc9..fb65778c7c 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/embedded/EmbeddedClientSessionProtocol.java @@ -356,29 +356,31 @@ public class EmbeddedClientSessionProtocol extends Lifecycle implements CDOSessi /** * @since 4.1 */ - public LockObjectsResult lockObjects2(List<CDORevisionKey> revisionKeys, int viewID, CDOBranch viewedBranch, - LockType lockType, long timeout) throws InterruptedException + public LockObjectsResult lockObjects2(List<CDORevisionKey> keys, int viewID, CDOBranch viewedBranch, LockType type, + boolean recursive, long timeout) throws InterruptedException { throw new UnsupportedOperationException(); } - public void unlockObjects(CDOView view, Collection<CDOID> objectIDs, LockType lockType) + @Deprecated + public void unlockObjects(CDOView view, Collection<CDOID> ids, LockType type) { throw new UnsupportedOperationException(); } - public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType) + public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> ids, LockType type, boolean recursive) { throw new UnsupportedOperationException(); } - public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> revisionKeys, - CDOBranch viewedBranch, LockType lockType, long timeout) throws InterruptedException + public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> keys, CDOBranch viewedBranch, + LockType type, boolean recursive, long timeout) throws InterruptedException { throw new UnsupportedOperationException(); } - public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType) + public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> ids, LockType type, + boolean recursive) { throw new UnsupportedOperationException(); } diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java index 9933d18650..a948344517 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java @@ -294,11 +294,11 @@ public abstract class SynchronizableRepository extends Repository.Default implem // TODO (CD) Consider this problem further long timeout = 0; - super.lock(view, lockType, lockables, null, timeout); + super.lock(view, lockType, lockables, null, false, timeout); } else if (lockChangeInfo.getOperation() == Operation.UNLOCK) { - super.doUnlock(view, lockType, lockables); + super.doUnlock(view, lockType, lockables, false); } else { @@ -550,11 +550,12 @@ public abstract class SynchronizableRepository extends Repository.Default implem } @Override - public LockObjectsResult lock(InternalView view, LockType lockType, List<CDORevisionKey> revisionKeys, long timeout) + public LockObjectsResult lock(InternalView view, LockType lockType, List<CDORevisionKey> revisionKeys, + boolean recursive, long timeout) { if (view.getBranch().isLocal()) { - return super.lock(view, lockType, revisionKeys, timeout); + return super.lock(view, lockType, revisionKeys, recursive, timeout); } if (getState() != ONLINE) @@ -562,11 +563,11 @@ public abstract class SynchronizableRepository extends Repository.Default implem throw new CDOException("Cannot lock in a non-local branch when clone is not connected to master"); } - return lockThrough(view, lockType, revisionKeys, timeout); + return lockThrough(view, lockType, revisionKeys, false, timeout); } - private LockObjectsResult lockOnMaster(InternalView view, LockType type, List<CDORevisionKey> revKeys, long timeout) - throws InterruptedException + private LockObjectsResult lockOnMaster(InternalView view, LockType type, List<CDORevisionKey> revKeys, + boolean recursive, long timeout) throws InterruptedException { // Delegate locking to the master InternalCDOSession remoteSession = getSynchronizer().getRemoteSession(); @@ -579,7 +580,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem } LockObjectsResult masterLockingResult = sessionProtocol.delegateLockObjects(areaID, revKeys, view.getBranch(), - type, timeout); + type, recursive, timeout); if (masterLockingResult.isSuccessful() && masterLockingResult.isWaitForUpdate()) { @@ -596,17 +597,18 @@ public abstract class SynchronizableRepository extends Repository.Default implem return masterLockingResult; } - private LockObjectsResult lockThrough(InternalView view, LockType type, List<CDORevisionKey> keys, long timeout) + private LockObjectsResult lockThrough(InternalView view, LockType type, List<CDORevisionKey> keys, boolean recursive, + long timeout) { try { - LockObjectsResult masterLockingResult = lockOnMaster(view, type, keys, timeout); + LockObjectsResult masterLockingResult = lockOnMaster(view, type, keys, recursive, timeout); if (!masterLockingResult.isSuccessful()) { return masterLockingResult; } - LockObjectsResult localLockingResult = super.lock(view, type, keys, timeout); + LockObjectsResult localLockingResult = super.lock(view, type, keys, recursive, timeout); return localLockingResult; } catch (InterruptedException ex) @@ -616,11 +618,11 @@ public abstract class SynchronizableRepository extends Repository.Default implem } @Override - public UnlockObjectsResult unlock(InternalView view, LockType lockType, List<CDOID> objectIDs) + public UnlockObjectsResult unlock(InternalView view, LockType lockType, List<CDOID> objectIDs, boolean recursive) { if (view.getBranch().isLocal()) { - super.unlock(view, lockType, objectIDs); + super.unlock(view, lockType, objectIDs, recursive); } if (getState() != ONLINE) @@ -628,10 +630,10 @@ public abstract class SynchronizableRepository extends Repository.Default implem throw new CDOException("Cannot unlock in a non-local branch when clone is not connected to master"); } - return unlockThrough(view, lockType, objectIDs); + return unlockThrough(view, lockType, objectIDs, recursive); } - private void unlockOnMaster(InternalView view, LockType lockType, List<CDOID> objectIDs) + private void unlockOnMaster(InternalView view, LockType lockType, List<CDOID> objectIDs, boolean recursive) { InternalCDOSession remoteSession = getSynchronizer().getRemoteSession(); CDOSessionProtocol sessionProtocol = remoteSession.getSessionProtocol(); @@ -642,13 +644,14 @@ public abstract class SynchronizableRepository extends Repository.Default implem throw new IllegalStateException("Durable locking is not enabled."); } - sessionProtocol.delegateUnlockObjects(lockAreaID, objectIDs, lockType); + sessionProtocol.delegateUnlockObjects(lockAreaID, objectIDs, lockType, recursive); } - private UnlockObjectsResult unlockThrough(InternalView view, LockType lockType, List<CDOID> objectIDs) + private UnlockObjectsResult unlockThrough(InternalView view, LockType lockType, List<CDOID> objectIDs, + boolean recursive) { - unlockOnMaster(view, lockType, objectIDs); - return super.unlock(view, lockType, objectIDs); + unlockOnMaster(view, lockType, objectIDs, recursive); + return super.unlock(view, lockType, objectIDs, recursive); } /** diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java index 4c2ac99469..fb4d730346 100644 --- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java +++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java @@ -63,14 +63,14 @@ public interface InternalLockManager extends IRWOLockManager<Object, IView>, IDu * @since 4.0 */ @Deprecated - public void lock(boolean explicit, LockType type, IView context, Collection<? extends Object> objectsToLock, - long timeout) throws InterruptedException; + public void lock(boolean explicit, LockType type, IView context, Collection<? extends Object> objects, long timeout) + throws InterruptedException; /** * @since 4.1 */ public List<LockState<Object, IView>> lock2(boolean explicit, LockType type, IView context, - Collection<? extends Object> objectsToLock, long timeout) throws InterruptedException; + Collection<? extends Object> objects, boolean recursive, long timeout) throws InterruptedException; /** * Attempts to release for a given locktype, view and objects. @@ -80,13 +80,13 @@ public interface InternalLockManager extends IRWOLockManager<Object, IView>, IDu * @since 4.0 */ @Deprecated - public void unlock(boolean explicit, LockType type, IView context, Collection<? extends Object> objectsToUnlock); + public void unlock(boolean explicit, LockType type, IView context, Collection<? extends Object> objects); /** * @since 4.1 */ public List<LockState<Object, IView>> unlock2(boolean explicit, LockType type, IView context, - Collection<? extends Object> objectsToUnlock); + Collection<? extends Object> objects, boolean recursive); /** * Attempts to release all locks(read and write) for a given view. 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 8b7f559583..b9cb5cfdbe 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 @@ -221,10 +221,11 @@ public interface InternalRepository extends IRepository, PackageProcessor, Packa /** * @since 4.1 */ - public LockObjectsResult lock(InternalView view, LockType lockType, List<CDORevisionKey> revisionKeys, long timeout); + public LockObjectsResult lock(InternalView view, LockType type, List<CDORevisionKey> keys, boolean recursive, + long timeout); /** * @since 4.1 */ - public UnlockObjectsResult unlock(InternalView view, LockType lockType, List<CDOID> objectIDs); + public UnlockObjectsResult unlock(InternalView view, LockType type, List<CDOID> ids, boolean recursive); } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java index 810cdcfa7e..c5de6782e9 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java @@ -1048,4 +1048,40 @@ public class LockingManagerTest extends AbstractLockingTest company.getCategories().add(category); objects.add(CDOUtil.getCDOObject(category)); } + + public void testRecursiveLock() throws Exception + { + CDOSession session = openSession(); + session.options().setPassiveUpdateEnabled(false); + CDOTransaction transaction = session.openTransaction(); + CDOResource res = transaction.createResource(getResourcePath("/res1")); + + Category category1 = getModel1Factory().createCategory(); + Category category2_1 = getModel1Factory().createCategory(); + Category category2_2 = getModel1Factory().createCategory(); + Category category3 = getModel1Factory().createCategory(); + res.getContents().add(category1); + category1.getCategories().add(category2_1); + category1.getCategories().add(category2_2); + category2_1.getCategories().add(category3); + + transaction.commit(); + + CDOObject top = CDOUtil.getCDOObject(category1); + transaction.lockObjects(Collections.singleton(top), LockType.WRITE, 5000, true); + + assertWriteLock(true, category1); + assertWriteLock(true, category2_1); + assertWriteLock(true, category2_2); + assertWriteLock(true, category3); + + transaction.unlockObjects(Collections.singleton(top), LockType.WRITE, true); + + assertWriteLock(false, category1); + assertWriteLock(false, category2_1); + assertWriteLock(false, category2_2); + assertWriteLock(false, category3); + + session.close(); + } } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOLock.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOLock.java index 4091ae4c10..2fa2608501 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOLock.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/CDOLock.java @@ -36,8 +36,6 @@ public interface CDOLock extends Lock public static final int NO_WAIT = IRWLockManager.NO_WAIT; /** - * TODO Simon: JavaDoc - * * @since 3.0 */ public LockType getType(); diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java index 018fd4a47e..9b82229983 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java @@ -556,6 +556,12 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction delegate.lockObjects(objects, lockType, timeout); } + public void lockObjects(Collection<? extends CDOObject> objects, LockType lockType, long timeout, boolean recursive) + throws InterruptedException + { + delegate.lockObjects(objects, lockType, timeout, recursive); + } + public Options options() { return delegate.options(); @@ -645,6 +651,11 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction delegate.unlockObjects(objects, lockType); } + public void unlockObjects(Collection<? extends CDOObject> objects, LockType lockType, boolean recursive) + { + delegate.unlockObjects(objects, lockType, recursive); + } + /** * @since 4.0 */ diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java index b3e57dc79f..a0cc14a4a5 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/view/CDOView.java @@ -336,11 +336,16 @@ public interface CDOView extends CDOCommonView, CDOUpdatable, INotifier public void lockObjects(Collection<? extends CDOObject> objects, LockType lockType, long timeout) throws InterruptedException; + public void lockObjects(Collection<? extends CDOObject> objects, LockType lockType, long timeout, boolean recursive) + throws InterruptedException; + /** * Unlocks the given locked objects of this view. */ public void unlockObjects(Collection<? extends CDOObject> objects, LockType lockType); + public void unlockObjects(Collection<? extends CDOObject> objects, LockType lockType, boolean recursive); + /** * Unlocks all locked objects of this view. * diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/DelegatingSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/DelegatingSessionProtocol.java index 57d7fd100e..055088145c 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/DelegatingSessionProtocol.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/DelegatingSessionProtocol.java @@ -638,7 +638,7 @@ public class DelegatingSessionProtocol extends Lifecycle implements CDOSessionPr * @since 4.1 */ public LockObjectsResult lockObjects2(List<CDORevisionKey> revisionKeys, int viewID, CDOBranch viewedBranch, - LockType lockType, long timeout) throws InterruptedException + LockType lockType, boolean recursive, long timeout) throws InterruptedException { int attempt = 0; @@ -646,7 +646,7 @@ public class DelegatingSessionProtocol extends Lifecycle implements CDOSessionPr { try { - return delegate.lockObjects2(revisionKeys, viewID, viewedBranch, lockType, timeout); + return delegate.lockObjects2(revisionKeys, viewID, viewedBranch, lockType, recursive, timeout); } catch (Exception ex) { @@ -656,14 +656,14 @@ public class DelegatingSessionProtocol extends Lifecycle implements CDOSessionPr } public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> revisionKeys, - CDOBranch viewedBranch, LockType lockType, long timeout) throws InterruptedException + CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout) throws InterruptedException { int attempt = 0; for (;;) { try { - return delegate.delegateLockObjects(lockAreaID, revisionKeys, viewedBranch, lockType, timeout); + return delegate.delegateLockObjects(lockAreaID, revisionKeys, viewedBranch, lockType, recursive, timeout); } catch (Exception ex) { @@ -672,14 +672,15 @@ public class DelegatingSessionProtocol extends Lifecycle implements CDOSessionPr } } - public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType) + public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive) { int attempt = 0; for (;;) { try { - return delegate.delegateUnlockObjects(lockAreaID, objectIDs, lockType); + return delegate.delegateUnlockObjects(lockAreaID, objectIDs, lockType, recursive); } catch (Exception ex) { @@ -774,6 +775,7 @@ public class DelegatingSessionProtocol extends Lifecycle implements CDOSessionPr } } + @Deprecated public void unlockObjects(CDOView view, Collection<CDOID> objectIDs, LockType lockType) { int attempt = 0; @@ -791,14 +793,15 @@ public class DelegatingSessionProtocol extends Lifecycle implements CDOSessionPr } } - public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType) + public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive) { int attempt = 0; for (;;) { try { - return delegate.unlockObjects2(view, objectIDs, lockType); + return delegate.unlockObjects2(view, objectIDs, lockType, recursive); } catch (Exception ex) { diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java index c261acbbbb..574f745b63 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java @@ -267,6 +267,12 @@ public class CDOViewImpl extends AbstractCDOView public synchronized void lockObjects(Collection<? extends CDOObject> objects, LockType lockType, long timeout) throws InterruptedException { + lockObjects(objects, lockType, timeout, false); + } + + public synchronized void lockObjects(Collection<? extends CDOObject> objects, LockType lockType, long timeout, + boolean recursive) throws InterruptedException + { checkActive(); checkState(getTimeStamp() == CDOBranchPoint.UNSPECIFIED_DATE, "Locking not supported for historial views"); @@ -280,8 +286,16 @@ public class CDOViewImpl extends AbstractCDOView } } + // Even if objects is not empty, revisionKeys may be empty, due to all of the + // objects being NEW or TRANSIENT. In such a case there is nothing to do + if (revisionKeys.isEmpty()) + { + return; + } + CDOSessionProtocol sessionProtocol = session.getSessionProtocol(); - LockObjectsResult result = sessionProtocol.lockObjects2(revisionKeys, viewID, getBranch(), lockType, timeout); + LockObjectsResult result = sessionProtocol.lockObjects2(revisionKeys, viewID, getBranch(), lockType, recursive, + timeout); if (!result.isSuccessful()) { @@ -443,6 +457,11 @@ public class CDOViewImpl extends AbstractCDOView */ public synchronized void unlockObjects(Collection<? extends CDOObject> objects, LockType lockType) { + unlockObjects(objects, lockType, false); + } + + public synchronized void unlockObjects(Collection<? extends CDOObject> objects, LockType lockType, boolean recursive) + { checkActive(); List<CDOID> objectIDs = null; @@ -456,7 +475,7 @@ public class CDOViewImpl extends AbstractCDOView } CDOSessionProtocol sessionProtocol = session.getSessionProtocol(); - UnlockObjectsResult result = sessionProtocol.unlockObjects2(this, objectIDs, lockType); + UnlockObjectsResult result = sessionProtocol.unlockObjects2(this, objectIDs, lockType, recursive); updateAndNotifyLockStates(Operation.UNLOCK, lockType, result.getTimestamp(), result.getNewLockStates()); } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java index 1dfe6e0bb9..cd92848d22 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/CDOSessionProtocol.java @@ -139,10 +139,8 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo public boolean cancelQuery(int queryId); /** - * Use #lockObjects2 instead. - * * @since 4.0 - * @deprecated Not called anymore. + * @deprecated Not called anymore. Use {@link #lockObjects2(List, int, CDOBranch, LockType, boolean, long)} instead. */ @Deprecated public LockObjectsResult lockObjects(List<InternalCDORevision> viewedRevisions, int viewID, CDOBranch viewedBranch, @@ -152,28 +150,32 @@ public interface CDOSessionProtocol extends CDOProtocol, PackageLoader, BranchLo * @since 4.1 */ public LockObjectsResult lockObjects2(List<CDORevisionKey> revisionKeys, int viewID, CDOBranch viewedBranch, - LockType lockType, long timeout) throws InterruptedException; + LockType lockType, boolean recursive, long timeout) throws InterruptedException; /** * @since 4.1 */ public LockObjectsResult delegateLockObjects(String lockAreaID, List<CDORevisionKey> revisionKeys, - CDOBranch viewedBranch, LockType lockType, long timeout) throws InterruptedException; + CDOBranch viewedBranch, LockType lockType, boolean recursive, long timeout) throws InterruptedException; /** * @since 3.0 + * @deprecated Not called anymore. Use {@link #unlockObjects2(CDOView, Collection, LockType, boolean)} instead. */ + @Deprecated public void unlockObjects(CDOView view, Collection<CDOID> objectIDs, LockType lockType); /** * @since 4.1 */ - public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType); + public UnlockObjectsResult unlockObjects2(CDOView view, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive); /** * @since 4.1 */ - public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType); + public UnlockObjectsResult delegateUnlockObjects(String lockAreaID, Collection<CDOID> objectIDs, LockType lockType, + boolean recursive); /** * @since 3.0 |