Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban Dugueperoux2014-07-13 10:16:49 -0400
committerEsteban Dugueperoux2014-11-03 04:32:05 -0500
commit43fe7cfded275cd7857112cc91d85b8f6fc52783 (patch)
tree0a546a693ab61de72aee40fcdac6b777a2ca258b
parent9d482b4f66a3bc597a4ab18c8de98af89e481165 (diff)
downloadcdo-43fe7cfded275cd7857112cc91d85b8f6fc52783.tar.gz
cdo-43fe7cfded275cd7857112cc91d85b8f6fc52783.tar.xz
cdo-43fe7cfded275cd7857112cc91d85b8f6fc52783.zip
[359244] Provide API to get all locked objects
Add InternalLockManager.getLockStates() method in API to be able to get all locked objects. Bug: 359244 Change-Id: I76546c05c01f062c265255745c46fe276b536d4c Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
-rw-r--r--features/org.eclipse.net4j.util-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.util.ui-feature/feature.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockStateIndication.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF22
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalLockManager.java5
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java4
-rw-r--r--plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF62
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java8
9 files changed, 77 insertions, 49 deletions
diff --git a/features/org.eclipse.net4j.util-feature/feature.xml b/features/org.eclipse.net4j.util-feature/feature.xml
index db2328d37e..5a86371ff6 100644
--- a/features/org.eclipse.net4j.util-feature/feature.xml
+++ b/features/org.eclipse.net4j.util-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.util"
label="%featureName"
- version="4.3.100.qualifier"
+ version="4.4.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.net4j.util.ui-feature/feature.xml b/features/org.eclipse.net4j.util.ui-feature/feature.xml
index 505982cd5f..8de6f19174 100644
--- a/features/org.eclipse.net4j.util.ui-feature/feature.xml
+++ b/features/org.eclipse.net4j.util.ui-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.util.ui"
label="%featureName"
- version="4.3.100.qualifier"
+ version="4.4.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockStateIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockStateIndication.java
index 2f55b71de3..364789d8c5 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockStateIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/LockStateIndication.java
@@ -54,15 +54,26 @@ public class LockStateIndication extends CDOServerReadIndication
existingLockStates = new ArrayList<CDOLockState>();
int n = in.readInt();
- for (int i = 0; i < n; i++)
+ if (n == 0)
{
- Object key = indicatingCDOID(in, view.getBranch());
- LockState<Object, IView> lockState = lockManager.getLockState(key);
- if (lockState != null)
+ Collection<LockState<Object, IView>> lockStates = lockManager.getLockStates();
+ for (LockState<Object, IView> lockState : lockStates)
{
existingLockStates.add(CDOLockUtil.createLockState(lockState));
}
}
+ else
+ {
+ for (int i = 0; i < n; i++)
+ {
+ Object key = indicatingCDOID(in, view.getBranch());
+ LockState<Object, IView> lockState = lockManager.getLockState(key);
+ if (lockState != null)
+ {
+ existingLockStates.add(CDOLockUtil.createLockState(lockState));
+ }
+ }
+ }
}
private Object indicatingCDOID(CDODataInput in, CDOBranch viewedBranch) throws IOException
diff --git a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
index a6563bf9a2..02091e9c4a 100644
--- a/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server;singleton:=true
-Bundle-Version: 4.3.100.qualifier
+Bundle-Version: 4.4.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,18 +10,18 @@ Bundle-Activator: org.eclipse.emf.cdo.internal.server.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Require-Bundle: org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.internal.server;version="4.3.100";
+Export-Package: org.eclipse.emf.cdo.internal.server;version="4.4.0";
x-friends:="org.eclipse.emf.cdo.server.db,
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.workspace,
org.eclipse.emf.cdo.server.hibernate",
- org.eclipse.emf.cdo.internal.server.bundle;version="4.3.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.server.embedded;version="4.3.100";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.server.mem;version="4.3.100";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.server.messages;version="4.3.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.server.syncing;version="4.3.100";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.server;version="4.3.100",
- org.eclipse.emf.cdo.server.embedded;version="4.3.100",
- org.eclipse.emf.cdo.server.mem;version="4.3.100",
- org.eclipse.emf.cdo.spi.server;version="4.3.100"
+ org.eclipse.emf.cdo.internal.server.bundle;version="4.4.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.server.embedded;version="4.4.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.server.mem;version="4.4.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.server.messages;version="4.4.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.server.syncing;version="4.4.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.server;version="4.4.0",
+ org.eclipse.emf.cdo.server.embedded;version="4.4.0",
+ org.eclipse.emf.cdo.server.mem;version="4.4.0",
+ org.eclipse.emf.cdo.spi.server;version="4.4.0"
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 3750ea442c..1fede4bc47 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
@@ -133,6 +133,11 @@ public interface InternalLockManager extends IRWOLockManager<Object, IView>, ILo
public LockState<Object, IView> getLockState(Object key);
/**
+ * @since 4.4
+ */
+ public List<LockState<Object, IView>> getLockStates();
+
+ /**
* @since 4.1
*/
public void setLockState(Object key, LockState<Object, IView> lockState);
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 056ff190c5..385ae783e3 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
@@ -756,7 +756,7 @@ public class CDOViewImpl extends AbstractCDOView
}
}
- if (loadOnDemand && missing.size() > 0)
+ if (loadOnDemand && (missing.size() > 0 || ids.isEmpty()))
{
CDOSessionProtocol sessionProtocol = session.getSessionProtocol();
CDOLockState[] loadedLockStates = sessionProtocol.getLockStates(viewID, missing);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
index e0f6852271..7a7d12c8ab 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
@@ -165,6 +165,10 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
public void handleLockNotification(InternalCDOView sender, CDOLockChangeInfo lockChangeInfo);
/**
+ * Get an array of {@link CDOLockState lock states} corresponding to the specified collection of {@link CDOID ids}.
+ *
+ * If the collection of {@link CDOID ids} is empty, {@link CDOLockState lock states} of all locked objects are returned.
+ *
* @since 4.1
*/
public CDOLockState[] getLockStates(Collection<CDOID> ids);
diff --git a/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
index 27ac1051d4..e85dcff502 100644
--- a/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.util;singleton:=true
-Bundle-Version: 3.4.100.qualifier
+Bundle-Version: 3.5.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -15,34 +15,34 @@ Import-Package: org.eclipse.osgi.service.debug;version="[1.0.0,2.0.0)";resolutio
org.osgi.framework;version="[1.3.0,2.0.0)";resolution:=optional,
org.osgi.service.log;version="[1.3.0,2.0.0)";resolution:=optional,
org.osgi.util.tracker;version="[1.3.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.net4j.internal.util.bundle;version="3.4.100";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
- org.eclipse.net4j.internal.util.container;version="3.4.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.factory;version="3.4.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.om;version="3.4.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.om.pref;version="3.4.100";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.table;version="3.4.100";x-internal:=true,
- org.eclipse.net4j.internal.util.test;version="3.4.100";x-friends:="org.eclipse.net4j.tests",
- org.eclipse.net4j.util;version="3.4.100",
- org.eclipse.net4j.util.cache;version="3.4.100",
- org.eclipse.net4j.util.collection;version="3.4.100",
- org.eclipse.net4j.util.concurrent;version="3.4.100",
- org.eclipse.net4j.util.confirmation;version="3.4.100",
- org.eclipse.net4j.util.container;version="3.4.100",
- org.eclipse.net4j.util.container.delegate;version="3.4.100",
- org.eclipse.net4j.util.event;version="3.4.100",
- org.eclipse.net4j.util.factory;version="3.4.100",
- org.eclipse.net4j.util.fsm;version="3.4.100",
- org.eclipse.net4j.util.io;version="3.4.100",
- org.eclipse.net4j.util.lifecycle;version="3.4.100",
- org.eclipse.net4j.util.om;version="3.4.100",
- org.eclipse.net4j.util.om.log;version="3.4.100",
- org.eclipse.net4j.util.om.monitor;version="3.4.100",
- org.eclipse.net4j.util.om.pref;version="3.4.100",
- org.eclipse.net4j.util.om.trace;version="3.4.100",
- org.eclipse.net4j.util.options;version="3.4.100",
- org.eclipse.net4j.util.properties;version="3.4.100",
- org.eclipse.net4j.util.ref;version="3.4.100",
- org.eclipse.net4j.util.registry;version="3.4.100",
- org.eclipse.net4j.util.security;version="3.4.100",
- org.eclipse.net4j.util.transaction;version="3.4.100"
+Export-Package: org.eclipse.net4j.internal.util.bundle;version="3.5.0";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
+ org.eclipse.net4j.internal.util.container;version="3.5.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.factory;version="3.5.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.om;version="3.5.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.om.pref;version="3.5.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.table;version="3.5.0";x-internal:=true,
+ org.eclipse.net4j.internal.util.test;version="3.5.0";x-friends:="org.eclipse.net4j.tests",
+ org.eclipse.net4j.util;version="3.5.0",
+ org.eclipse.net4j.util.cache;version="3.5.0",
+ org.eclipse.net4j.util.collection;version="3.5.0",
+ org.eclipse.net4j.util.concurrent;version="3.5.0",
+ org.eclipse.net4j.util.confirmation;version="3.5.0",
+ org.eclipse.net4j.util.container;version="3.5.0",
+ org.eclipse.net4j.util.container.delegate;version="3.5.0",
+ org.eclipse.net4j.util.event;version="3.5.0",
+ org.eclipse.net4j.util.factory;version="3.5.0",
+ org.eclipse.net4j.util.fsm;version="3.5.0",
+ org.eclipse.net4j.util.io;version="3.5.0",
+ org.eclipse.net4j.util.lifecycle;version="3.5.0",
+ org.eclipse.net4j.util.om;version="3.5.0",
+ org.eclipse.net4j.util.om.log;version="3.5.0",
+ org.eclipse.net4j.util.om.monitor;version="3.5.0",
+ org.eclipse.net4j.util.om.pref;version="3.5.0",
+ org.eclipse.net4j.util.om.trace;version="3.5.0",
+ org.eclipse.net4j.util.options;version="3.5.0",
+ org.eclipse.net4j.util.properties;version="3.5.0",
+ org.eclipse.net4j.util.ref;version="3.5.0",
+ org.eclipse.net4j.util.registry;version="3.5.0",
+ org.eclipse.net4j.util.security;version="3.5.0",
+ org.eclipse.net4j.util.transaction;version="3.5.0"
Eclipse-BuddyPolicy: registered
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java
index 9ba3cc2366..3ad1fc03ef 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java
@@ -338,6 +338,14 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
return objectToLockStateMap.get(key);
}
+ /**
+ * @since 3.5
+ */
+ public synchronized List<LockState<OBJECT, CONTEXT>> getLockStates()
+ {
+ return new ArrayList<RWOLockManager.LockState<OBJECT, CONTEXT>>(objectToLockStateMap.values());
+ }
+
public synchronized void setLockState(OBJECT key, LockState<OBJECT, CONTEXT> lockState)
{
objectToLockStateMap.put(key, lockState);

Back to the top