Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2016-07-30 08:19:15 -0400
committerEike Stepper2016-07-30 09:17:13 -0400
commit0dd7b28ec37f964088f3d9be8383f15c4a665e78 (patch)
tree7cf7392277825440a53ca835ba593662729e70e0
parent915fe3f55eb53acb190536a314e885d2a05d9720 (diff)
downloadcdo-0dd7b28ec37f964088f3d9be8383f15c4a665e78.tar.gz
cdo-0dd7b28ec37f964088f3d9be8383f15c4a665e78.tar.xz
cdo-0dd7b28ec37f964088f3d9be8383f15c4a665e78.zip
[387563] Generalize the "lock of new objects on commit" feature to the "lock/unlock objects on commit"
https://bugs.eclipse.org/bugs/show_bug.cgi?id=387563
-rw-r--r--features/org.eclipse.emf.cdo-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.defs-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.epp-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.explorer-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.sdk-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.server-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.server.hibernate-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.tests-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.db-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.defs-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.sdk-feature/feature.xml2
-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.common/META-INF/MANIFEST.MF68
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java59
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java46
-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/internal/server/DelegatingCommitContext.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/TransactionCommitContext.java194
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java34
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF26
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingNotificationsTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355045_Test.java205
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563_Test.java181
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563b_Test.java114
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_466951_Test.java137
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF36
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/plugin.xml1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AutoReleaseLockExemptionAction.java91
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java119
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties1
-rw-r--r--plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF52
-rw-r--r--plugins/org.eclipse.emf.cdo/plugin.xml6
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java29
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java111
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/ObjectProperties.java23
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java257
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUndoDetectorImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java26
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java137
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/ViewProperties.java23
-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/collection/HashBag.java14
-rw-r--r--plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java171
-rw-r--r--plugins/org.eclipse.net4j/META-INF/MANIFEST.MF32
-rw-r--r--plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalCounter.java42
62 files changed, 1794 insertions, 698 deletions
diff --git a/features/org.eclipse.emf.cdo-feature/feature.xml b/features/org.eclipse.emf.cdo-feature/feature.xml
index 03d6062372..9799634f5e 100644
--- a/features/org.eclipse.emf.cdo-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo-feature/feature.xml
@@ -13,7 +13,7 @@
<feature
id="org.eclipse.emf.cdo"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.emf.cdo.defs-feature/feature.xml b/features/org.eclipse.emf.cdo.defs-feature/feature.xml
index 2d0a3ee599..2b8f3a2a25 100644
--- a/features/org.eclipse.emf.cdo.defs-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.defs-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.defs"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.emf.cdo.epp-feature/feature.xml b/features/org.eclipse.emf.cdo.epp-feature/feature.xml
index 32f3677491..709e38f5bf 100644
--- a/features/org.eclipse.emf.cdo.epp-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.epp-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.epp"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.emf.cdo.explorer-feature/feature.xml b/features/org.eclipse.emf.cdo.explorer-feature/feature.xml
index 8482d22137..4b0a638e03 100644
--- a/features/org.eclipse.emf.cdo.explorer-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.explorer-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.explorer"
label="%featureName"
- version="4.4.0.qualifier"
+ version="4.5.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg">
diff --git a/features/org.eclipse.emf.cdo.sdk-feature/feature.xml b/features/org.eclipse.emf.cdo.sdk-feature/feature.xml
index 37de3f73e1..7177707f0b 100644
--- a/features/org.eclipse.emf.cdo.sdk-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.sdk-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.sdk"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.emf.cdo.server-feature/feature.xml b/features/org.eclipse.emf.cdo.server-feature/feature.xml
index 579b725fbd..afc8747202 100644
--- a/features/org.eclipse.emf.cdo.server-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.server-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.server"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.emf.cdo.server.hibernate-feature/feature.xml b/features/org.eclipse.emf.cdo.server.hibernate-feature/feature.xml
index 1e15b7afed..9a8ece9761 100644
--- a/features/org.eclipse.emf.cdo.server.hibernate-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.server.hibernate-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.server.hibernate"
label="%featureName"
- version="4.2.300.qualifier"
+ version="4.2.400.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.emf.cdo.tests-feature/feature.xml b/features/org.eclipse.emf.cdo.tests-feature/feature.xml
index ff9e97c7b9..c7288c73ad 100644
--- a/features/org.eclipse.emf.cdo.tests-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.tests-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.tests"
label="%featureName"
- version="4.2.300.qualifier"
+ version="4.2.400.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.net4j-feature/feature.xml b/features/org.eclipse.net4j-feature/feature.xml
index 7c97421f40..0891d328c3 100644
--- a/features/org.eclipse.net4j-feature/feature.xml
+++ b/features/org.eclipse.net4j-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.net4j.db-feature/feature.xml b/features/org.eclipse.net4j.db-feature/feature.xml
index c65973c2bb..15fe440a56 100644
--- a/features/org.eclipse.net4j.db-feature/feature.xml
+++ b/features/org.eclipse.net4j.db-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.db"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.net4j.defs-feature/feature.xml b/features/org.eclipse.net4j.defs-feature/feature.xml
index c08b74ace9..b907ccee41 100644
--- a/features/org.eclipse.net4j.defs-feature/feature.xml
+++ b/features/org.eclipse.net4j.defs-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.defs"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.net4j.sdk-feature/feature.xml b/features/org.eclipse.net4j.sdk-feature/feature.xml
index e538401696..4ead21b3bb 100644
--- a/features/org.eclipse.net4j.sdk-feature/feature.xml
+++ b/features/org.eclipse.net4j.sdk-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.sdk"
label="%featureName"
- version="4.5.0.qualifier"
+ version="4.6.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-feature/feature.xml b/features/org.eclipse.net4j.util-feature/feature.xml
index db78136d07..090cf7b7ce 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.5.0.qualifier"
+ version="4.6.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 2e654465f0..897cc10c4e 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.5.0.qualifier"
+ version="4.6.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.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
index f9852b96bc..05e58aba70 100644
--- a/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.common/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.common
-Bundle-Version: 4.5.0.qualifier
+Bundle-Version: 4.6.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -14,21 +14,21 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)";visibili
org.eclipse.emf.ecore.change;bundle-version="[2.5.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.ecore.xmi;bundle-version="[2.5.0,3.0.0)";visibility:=reexport,
org.eclipse.net4j.util;bundle-version="[3.0.0,4.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.common;version="4.5.0",
- org.eclipse.emf.cdo.common.admin;version="4.5.0",
- org.eclipse.emf.cdo.common.branch;version="4.5.0",
- org.eclipse.emf.cdo.common.commit;version="4.5.0",
- org.eclipse.emf.cdo.common.commit.handler;version="4.5.0",
- org.eclipse.emf.cdo.common.id;version="4.5.0",
- org.eclipse.emf.cdo.common.lob;version="4.5.0",
- org.eclipse.emf.cdo.common.lock;version="4.5.0",
- org.eclipse.emf.cdo.common.model;version="4.5.0",
- org.eclipse.emf.cdo.common.protocol;version="4.5.0",
- org.eclipse.emf.cdo.common.revision;version="4.5.0",
- org.eclipse.emf.cdo.common.revision.delta;version="4.5.0",
- org.eclipse.emf.cdo.common.security;version="4.5.0",
- org.eclipse.emf.cdo.common.util;version="4.5.0",
- org.eclipse.emf.cdo.internal.common;version="4.5.0";
+Export-Package: org.eclipse.emf.cdo.common;version="4.6.0",
+ org.eclipse.emf.cdo.common.admin;version="4.6.0",
+ org.eclipse.emf.cdo.common.branch;version="4.6.0",
+ org.eclipse.emf.cdo.common.commit;version="4.6.0",
+ org.eclipse.emf.cdo.common.commit.handler;version="4.6.0",
+ org.eclipse.emf.cdo.common.id;version="4.6.0",
+ org.eclipse.emf.cdo.common.lob;version="4.6.0",
+ org.eclipse.emf.cdo.common.lock;version="4.6.0",
+ org.eclipse.emf.cdo.common.model;version="4.6.0",
+ org.eclipse.emf.cdo.common.protocol;version="4.6.0",
+ org.eclipse.emf.cdo.common.revision;version="4.6.0",
+ org.eclipse.emf.cdo.common.revision.delta;version="4.6.0",
+ org.eclipse.emf.cdo.common.security;version="4.6.0",
+ org.eclipse.emf.cdo.common.util;version="4.6.0",
+ org.eclipse.emf.cdo.internal.common;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -38,11 +38,11 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.5.0",
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.server.hibernate",
- org.eclipse.emf.cdo.internal.common.branch;version="4.5.0";
+ org.eclipse.emf.cdo.internal.common.branch;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.server.hibernate",
- org.eclipse.emf.cdo.internal.common.bundle;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.common.commit;version="4.5.0";
+ org.eclipse.emf.cdo.internal.common.bundle;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.common.commit;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -51,7 +51,7 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.5.0",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.id;version="4.5.0";
+ org.eclipse.emf.cdo.internal.common.id;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -62,9 +62,9 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.5.0",
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.admin,
org.eclipse.emf.cdo.server.admin",
- org.eclipse.emf.cdo.internal.common.lock;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.common.messages;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.common.model;version="4.5.0";
+ org.eclipse.emf.cdo.internal.common.lock;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.common.messages;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.common.model;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -73,7 +73,7 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.5.0",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision;version="4.5.0";
+ org.eclipse.emf.cdo.internal.common.revision;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -82,7 +82,7 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.5.0",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.common.revision.delta;version="4.5.0";
+ org.eclipse.emf.cdo.internal.common.revision.delta;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.common,
org.eclipse.emf.cdo.common.db,
org.eclipse.emf.cdo,
@@ -91,12 +91,12 @@ Export-Package: org.eclipse.emf.cdo.common;version="4.5.0",
org.eclipse.emf.cdo.server.net4j,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.spi.common;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.admin;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.branch;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.commit;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.id;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.lock;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.model;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.protocol;version="4.5.0",
- org.eclipse.emf.cdo.spi.common.revision;version="4.5.0"
+ org.eclipse.emf.cdo.spi.common;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.admin;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.branch;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.commit;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.id;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.lock;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.model;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.protocol;version="4.6.0",
+ org.eclipse.emf.cdo.spi.common.revision;version="4.6.0"
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java
index 4d5b8bddc2..cb0dac0f83 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/lock/InternalCDOLockState.java
@@ -10,8 +10,10 @@
*/
package org.eclipse.emf.cdo.spi.common.lock;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.internal.common.lock.CDOLockStateImpl;
/**
* If the meaning of this type isn't clear, there really should be more of a description here...
@@ -23,6 +25,11 @@ import org.eclipse.emf.cdo.common.lock.CDOLockState;
*/
public interface InternalCDOLockState extends CDOLockState
{
+ /**
+ * @since 4.6
+ */
+ public static final CDOLockState UNLOCKED = new CDOLockStateImpl(CDOID.NULL);
+
public void addReadLockOwner(CDOLockOwner lockOwner);
public boolean removeReadLockOwner(CDOLockOwner lockOwner);
diff --git a/plugins/org.eclipse.emf.cdo.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.net4j/META-INF/MANIFEST.MF
index 32eca96ebf..6d13a12a79 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.net4j/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.net4j; singleton:=true
-Bundle-Version: 4.1.400.qualifier
+Bundle-Version: 4.1.500.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,17 +10,17 @@ Bundle-Activator: org.eclipse.emf.cdo.internal.net4j.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.internal.net4j;version="4.1.400";
+Export-Package: org.eclipse.emf.cdo.internal.net4j;version="4.1.500";
x-friends:="org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.examples",
- org.eclipse.emf.cdo.internal.net4j.bundle;version="4.1.400";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.net4j.messages;version="4.1.400";x-internal:=true,
- org.eclipse.emf.cdo.internal.net4j.protocol;version="4.1.400";
+ org.eclipse.emf.cdo.internal.net4j.bundle;version="4.1.500";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.net4j.messages;version="4.1.500";x-internal:=true,
+ org.eclipse.emf.cdo.internal.net4j.protocol;version="4.1.500";
x-friends:="org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.examples",
- org.eclipse.emf.cdo.net4j;version="4.1.400"
+ org.eclipse.emf.cdo.net4j;version="4.1.500"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java
index acf0b462c9..3f84e0d70f 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/CommitTransactionRequest.java
@@ -69,26 +69,24 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com
private static long sleepMillisForTesting = 0L;
- private CDOIDProvider idProvider; // CDOTransaction
+ private final int commitNumber;
- private int commitNumber;
+ private final String commitComment;
- private String commitComment;
+ private final CDOCommitData commitData;
- private boolean releaseLocks;
+ private final Collection<CDOLob<?>> lobs;
- private CDOCommitData commitData;
+ private final Collection<CDOLockState> locksOnNewObjects;
- private Collection<CDOLob<?>> lobs;
+ private final Collection<CDOID> idsToUnlock;
- private Collection<CDOLockState> locksOnNewObjects;
-
- private int viewID;
+ private final int viewID;
/**
* Is <code>null</code> in {@link CommitDelegationRequest}.
*/
- private InternalCDOTransaction transaction;
+ private final InternalCDOTransaction transaction;
private boolean clearResourcePathCache;
@@ -100,20 +98,23 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com
public CommitTransactionRequest(CDOClientProtocol protocol, short signalID, InternalCDOCommitContext context)
{
super(protocol, signalID);
-
transaction = context.getTransaction();
+
CommitToken commitToken = transaction.getCommitToken();
if (commitToken != null)
{
commitNumber = commitToken.getCommitNumber();
}
+ else
+ {
+ commitNumber = 0;
+ }
commitComment = context.getCommitComment();
- releaseLocks = context.isAutoReleaseLocks();
- idProvider = context.getTransaction();
commitData = context.getCommitData();
lobs = context.getLobs();
locksOnNewObjects = context.getLocksOnNewObjects();
+ idsToUnlock = context.getIDsToUnlock();
viewID = context.getViewID();
}
@@ -127,7 +128,7 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com
@Override
protected CDOIDProvider getIDProvider()
{
- return idProvider;
+ return transaction;
}
@Override
@@ -150,33 +151,43 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com
List<CDOIDAndVersion> detachedObjects = commitData.getDetachedObjects();
out.writeLong(getLastUpdateTime());
- out.writeBoolean(releaseLocks);
out.writeInt(commitNumber);
out.writeString(commitComment);
- out.writeInt(newPackageUnits.size());
out.writeInt(locksOnNewObjects.size());
+ out.writeInt(idsToUnlock.size());
+ out.writeInt(newPackageUnits.size());
out.writeInt(newObjects.size());
out.writeInt(changedObjects.size());
out.writeInt(detachedObjects.size());
if (TRACER.isEnabled())
{
- TRACER.format("Writing {0} new package units", newPackageUnits.size()); //$NON-NLS-1$
+ TRACER.format("Writing {0} locks on new objects", locksOnNewObjects.size()); //$NON-NLS-1$
}
- for (CDOPackageUnit newPackageUnit : newPackageUnits)
+ for (CDOLockState lockState : locksOnNewObjects)
{
- out.writeCDOPackageUnit(newPackageUnit, true);
+ out.writeCDOLockState(lockState);
}
if (TRACER.isEnabled())
{
- TRACER.format("Writing {0} locks on new objects", locksOnNewObjects.size()); //$NON-NLS-1$
+ TRACER.format("Writing {0} unlocks on changed objects", idsToUnlock.size()); //$NON-NLS-1$
}
- for (CDOLockState lockState : locksOnNewObjects)
+ for (CDOID id : idsToUnlock)
{
- out.writeCDOLockState(lockState);
+ out.writeCDOID(id);
+ }
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Writing {0} new package units", newPackageUnits.size()); //$NON-NLS-1$
+ }
+
+ for (CDOPackageUnit newPackageUnit : newPackageUnits)
+ {
+ out.writeCDOPackageUnit(newPackageUnit, true);
}
if (TRACER.isEnabled())
@@ -319,7 +330,7 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com
}
CommitTransactionResult result = new CommitTransactionResult();
- result.setIDProvider(idProvider);
+ result.setIDProvider(transaction);
result.setClearResourcePathCache(clearResourcePathCache);
result.setRollbackReason(in.readByte());
result.setRollbackMessage(in.readString());
@@ -345,7 +356,7 @@ public class CommitTransactionRequest extends CDOClientRequestWithMonitoring<Com
protected CommitTransactionResult confirmingResult(CDODataInput in) throws IOException
{
CommitTransactionResult result = new CommitTransactionResult();
- result.setIDProvider(idProvider);
+ result.setIDProvider(transaction);
result.setClearResourcePathCache(clearResourcePathCache);
result.setBranchPoint(in.readCDOBranchPoint());
result.setPreviousTimeStamp(in.readLong());
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
index bdab554bc5..be3924ee4b 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server.hibernate;singleton:=true
-Bundle-Version: 4.2.300.qualifier
+Bundle-Version: 4.2.400.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -14,11 +14,11 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.cdo.common;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j.db;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.server.hibernate;version="4.2.300",
- org.eclipse.emf.cdo.server.internal.hibernate;version="4.2.300";x-friends:="org.eclipse.emf.cdo.server.hibernate.teneo,org.eclipse.emf.cdo.tests.hibernate",
- org.eclipse.emf.cdo.server.internal.hibernate.bundle;version="4.2.300";x-internal:=true,
- org.eclipse.emf.cdo.server.internal.hibernate.info;version="4.2.300";x-friends:="org.eclipse.emf.cdo.server.hibernate.teneo,org.eclipse.emf.cdo.tests.hibernate",
- org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;version="4.2.300";x-friends:="org.eclipse.emf.cdo.server.hibernate.teneo,org.eclipse.emf.cdo.tests.hibernate"
+Export-Package: org.eclipse.emf.cdo.server.hibernate;version="4.2.400",
+ org.eclipse.emf.cdo.server.internal.hibernate;version="4.2.400";x-friends:="org.eclipse.emf.cdo.server.hibernate.teneo,org.eclipse.emf.cdo.tests.hibernate",
+ org.eclipse.emf.cdo.server.internal.hibernate.bundle;version="4.2.400";x-internal:=true,
+ org.eclipse.emf.cdo.server.internal.hibernate.info;version="4.2.400";x-friends:="org.eclipse.emf.cdo.server.hibernate.teneo,org.eclipse.emf.cdo.tests.hibernate",
+ org.eclipse.emf.cdo.server.internal.hibernate.tuplizer;version="4.2.400";x-friends:="org.eclipse.emf.cdo.server.hibernate.teneo,org.eclipse.emf.cdo.tests.hibernate"
Import-Package: org.apache.log4j;version="[1.2.0,2.0.0)",
org.eclipse.emf.teneo;version="[2.0.1,3.0.0)",
org.eclipse.emf.teneo.annotations.mapper;version="[2.0.1,3.0.0)",
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java
index ee8b86b579..6692fb2f87 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateRawCommitContext.java
@@ -125,6 +125,7 @@ public class HibernateRawCommitContext implements InternalCommitContext
{
}
+ @Deprecated
public boolean isAutoReleaseLocksEnabled()
{
return false;
@@ -160,6 +161,11 @@ public class HibernateRawCommitContext implements InternalCommitContext
return null;
}
+ public CDOID[] getIDsToUnlock()
+ {
+ return null;
+ }
+
public InternalCDORevision[] getNewObjects()
{
return newObjects.toArray(new InternalCDORevision[0]);
@@ -303,6 +309,10 @@ public class HibernateRawCommitContext implements InternalCommitContext
{
}
+ public void setIDsToUnlock(CDOID[] idsToUnlock)
+ {
+ }
+
public void setNewObjects(InternalCDORevision[] newObjects)
{
}
@@ -327,6 +337,7 @@ public class HibernateRawCommitContext implements InternalCommitContext
{
}
+ @Deprecated
public void setAutoReleaseLocksEnabled(boolean on)
{
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.net4j/META-INF/MANIFEST.MF
index 048d55afcd..9254099351 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server.net4j;singleton:=true
-Bundle-Version: 4.1.300.qualifier
+Bundle-Version: 4.1.400.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -12,6 +12,6 @@ Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)";resolution:=optional,
org.eclipse.emf.cdo.server;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.server.internal.net4j.bundle;version="4.1.300";x-internal:=true,
- org.eclipse.emf.cdo.server.internal.net4j.protocol;version="4.1.300";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.server.net4j;version="4.1.300"
+Export-Package: org.eclipse.emf.cdo.server.internal.net4j.bundle;version="4.1.400";x-internal:=true,
+ org.eclipse.emf.cdo.server.internal.net4j.protocol;version="4.1.400";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.server.net4j;version="4.1.400"
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
index 0b38c4471c..facc99bf1f 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
@@ -126,19 +126,44 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori
commitContext.preWrite();
long lastUpdateTime = in.readLong();
- boolean autoReleaseLocksEnabled = in.readBoolean();
int commitNumber = in.readInt();
String commitComment = in.readString();
- InternalCDOPackageUnit[] newPackageUnits = new InternalCDOPackageUnit[in.readInt()];
CDOLockState[] locksOnNewObjects = new CDOLockState[in.readInt()];
+ CDOID[] idsToUnlock = new CDOID[in.readInt()];
+ InternalCDOPackageUnit[] newPackageUnits = new InternalCDOPackageUnit[in.readInt()];
InternalCDORevision[] newObjects = new InternalCDORevision[in.readInt()];
InternalCDORevisionDelta[] dirtyObjectDeltas = new InternalCDORevisionDelta[in.readInt()];
CDOID[] detachedObjects = new CDOID[in.readInt()];
- monitor.begin(newPackageUnits.length + newObjects.length + dirtyObjectDeltas.length + detachedObjects.length);
+ monitor.begin(locksOnNewObjects.length + idsToUnlock.length + newPackageUnits.length + newObjects.length
+ + dirtyObjectDeltas.length + detachedObjects.length);
try
{
+ // Locks on new objects
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Reading {0} locks on new objects", locksOnNewObjects.length); //$NON-NLS-1$
+ }
+
+ for (int i = 0; i < locksOnNewObjects.length; i++)
+ {
+ locksOnNewObjects[i] = in.readCDOLockState();
+ monitor.worked();
+ }
+
+ // Unlocks on changed objects
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Reading {0} IDs to unlock", idsToUnlock.length); //$NON-NLS-1$
+ }
+
+ for (int i = 0; i < idsToUnlock.length; i++)
+ {
+ idsToUnlock[i] = in.readCDOID();
+ monitor.worked();
+ }
+
// New package units
if (TRACER.isEnabled())
{
@@ -161,18 +186,6 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori
EMFUtil.safeResolveAll(resourceSet);
}
- // Locks on new objects
- if (TRACER.isEnabled())
- {
- TRACER.format("Reading {0} locks on new objects", locksOnNewObjects.length); //$NON-NLS-1$
- }
-
- for (int i = 0; i < locksOnNewObjects.length; i++)
- {
- locksOnNewObjects[i] = in.readCDOLockState();
- monitor.worked();
- }
-
// New objects
if (TRACER.isEnabled())
{
@@ -274,7 +287,6 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori
commitContext.setCommitNumber(commitNumber);
commitContext.setLastUpdateTime(lastUpdateTime);
- commitContext.setAutoReleaseLocksEnabled(autoReleaseLocksEnabled);
commitContext.setClearResourcePathCache(clearResourcePathCache);
commitContext.setUsingEcore(usingEcore);
commitContext.setUsingEtypes(usingEtypes);
@@ -287,6 +299,8 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori
commitContext.setDetachedObjectVersions(detachedObjectVersions);
commitContext.setCommitComment(commitComment);
commitContext.setLobs(getIndicationStream());
+ commitContext.setLocksOnNewObjects(locksOnNewObjects);
+ commitContext.setIDsToUnlock(idsToUnlock);
}
finally
{
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 8a287f1d7e..3e0cb2e804 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.5.0.qualifier
+Bundle-Version: 4.6.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.5.0";
+Export-Package: org.eclipse.emf.cdo.internal.server;version="4.6.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.5.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.server.embedded;version="4.5.0";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.server.mem;version="4.5.0";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.server.messages;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.server.syncing;version="4.5.0";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.server;version="4.5.0",
- org.eclipse.emf.cdo.server.embedded;version="4.5.0",
- org.eclipse.emf.cdo.server.mem;version="4.5.0",
- org.eclipse.emf.cdo.spi.server;version="4.5.0"
+ org.eclipse.emf.cdo.internal.server.bundle;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.server.embedded;version="4.6.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.server.mem;version="4.6.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.server.messages;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.server.syncing;version="4.6.0";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.server;version="4.6.0",
+ org.eclipse.emf.cdo.server.embedded;version="4.6.0",
+ org.eclipse.emf.cdo.server.mem;version="4.6.0",
+ org.eclipse.emf.cdo.spi.server;version="4.6.0"
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingCommitContext.java
index a6872ffee7..bf696c809f 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/DelegatingCommitContext.java
@@ -61,11 +61,6 @@ public abstract class DelegatingCommitContext implements IStoreAccessor.CommitCo
return getDelegate().getCommitComment();
}
- public boolean isAutoReleaseLocksEnabled()
- {
- return getDelegate().isAutoReleaseLocksEnabled();
- }
-
public InternalCDOPackageRegistry getPackageRegistry()
{
return getDelegate().getPackageRegistry();
@@ -136,11 +131,22 @@ public abstract class DelegatingCommitContext implements IStoreAccessor.CommitCo
return getDelegate().isUsingEtypes();
}
+ @Deprecated
+ public boolean isAutoReleaseLocksEnabled()
+ {
+ return getDelegate().isAutoReleaseLocksEnabled();
+ }
+
public CDOLockState[] getLocksOnNewObjects()
{
return getDelegate().getLocksOnNewObjects();
}
+ public CDOID[] getIDsToUnlock()
+ {
+ return getDelegate().getIDsToUnlock();
+ }
+
public CDOBranchVersion[] getDetachedObjectVersions()
{
return getDelegate().getDetachedObjectVersions();
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 5163a45593..b20e5a377b 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
@@ -78,6 +78,7 @@ import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.collection.IndexedList;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+import org.eclipse.net4j.util.concurrent.RWOLockManager;
import org.eclipse.net4j.util.concurrent.RWOLockManager.LockState;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
@@ -92,7 +93,6 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -147,8 +147,6 @@ public class TransactionCommitContext implements InternalCommitContext
private InternalCDOPackageUnit[] newPackageUnits = new InternalCDOPackageUnit[0];
- private CDOLockState[] locksOnNewObjects = new CDOLockState[0];
-
private InternalCDORevision[] newObjects = new InternalCDORevision[0];
private InternalCDORevisionDelta[] dirtyObjectDeltas = new InternalCDORevisionDelta[0];
@@ -179,7 +177,7 @@ public class TransactionCommitContext implements InternalCommitContext
private List<CDOIDReference> xRefs;
- private List<LockState<Object, IView>> postCommitLockStates;
+ private final List<LockState<Object, IView>> postCommitLockStates = new ArrayList<LockState<Object, IView>>();
private boolean hasChanges;
@@ -187,10 +185,12 @@ public class TransactionCommitContext implements InternalCommitContext
private boolean ensuringReferentialIntegrity;
- private boolean autoReleaseLocksEnabled;
-
private ExtendedDataInputStream lobs;
+ private CDOLockState[] locksOnNewObjects = new CDOLockState[0];
+
+ private CDOID[] idsToUnlock = new CDOID[0];
+
private Map<Object, Object> data;
private CommitNotificationInfo commitNotificationInfo = new CommitNotificationInfo();
@@ -238,11 +238,6 @@ public class TransactionCommitContext implements InternalCommitContext
return lastUpdateTime;
}
- public boolean isAutoReleaseLocksEnabled()
- {
- return autoReleaseLocksEnabled;
- }
-
public byte getRollbackReason()
{
return rollbackReason;
@@ -294,11 +289,6 @@ public class TransactionCommitContext implements InternalCommitContext
return newPackageUnits;
}
- public CDOLockState[] getLocksOnNewObjects()
- {
- return locksOnNewObjects;
- }
-
public InternalCDORevision[] getNewObjects()
{
return newObjects;
@@ -526,11 +516,6 @@ public class TransactionCommitContext implements InternalCommitContext
this.newPackageUnits = newPackageUnits;
}
- public void setLocksOnNewObjects(CDOLockState[] locksOnNewObjects)
- {
- this.locksOnNewObjects = locksOnNewObjects;
- }
-
public void setNewObjects(InternalCDORevision[] newObjects)
{
this.newObjects = newObjects;
@@ -561,11 +546,6 @@ public class TransactionCommitContext implements InternalCommitContext
this.lastUpdateTime = lastUpdateTime;
}
- public void setAutoReleaseLocksEnabled(boolean on)
- {
- autoReleaseLocksEnabled = on;
- }
-
public void setCommitNumber(int commitNumber)
{
this.commitNumber = commitNumber;
@@ -586,6 +566,38 @@ public class TransactionCommitContext implements InternalCommitContext
lobs = in;
}
+ @Deprecated
+ public boolean isAutoReleaseLocksEnabled()
+ {
+ return false;
+ }
+
+ @Deprecated
+ public void setAutoReleaseLocksEnabled(boolean on)
+ {
+ // Do nothing.
+ }
+
+ public CDOLockState[] getLocksOnNewObjects()
+ {
+ return locksOnNewObjects;
+ }
+
+ public void setLocksOnNewObjects(CDOLockState[] locksOnNewObjects)
+ {
+ this.locksOnNewObjects = locksOnNewObjects;
+ }
+
+ public CDOID[] getIDsToUnlock()
+ {
+ return idsToUnlock;
+ }
+
+ public void setIDsToUnlock(CDOID[] idsToUnlock)
+ {
+ this.idsToUnlock = idsToUnlock;
+ }
+
public <T> T getData(Object key)
{
if (data == null)
@@ -1107,50 +1119,6 @@ public class TransactionCommitContext implements InternalCommitContext
}
}
- protected synchronized void unlockObjects()
- {
- // Unlock objects locked during commit
- if (!lockedObjects.isEmpty())
- {
- lockManager.unlock2(LockType.WRITE, transaction, lockedObjects);
- lockedObjects.clear();
- }
-
- // Release durable locks that have been acquired on detached objects
- if (detachedObjects.length > 0)
- {
- boolean branching = repository.isSupportingBranches();
- Collection<? extends Object> unlockables;
- if (branching)
- {
- List<CDOIDAndBranch> keys = new ArrayList<CDOIDAndBranch>(detachedObjects.length);
- for (CDOID id : detachedObjects)
- {
- CDOIDAndBranch idAndBranch = CDOIDUtil.createIDAndBranch(id, branch);
- keys.add(idAndBranch);
- }
-
- unlockables = keys;
- }
- else
- {
- unlockables = Arrays.asList(detachedObjects);
- }
-
- // We only need to consider detached objects that have been explicitly locked
- Collection<Object> detachedObjectsToUnlock = new ArrayList<Object>();
- for (Object unlockable : unlockables)
- {
- if (lockManager.hasLock(LockType.WRITE, transaction, unlockable))
- {
- detachedObjectsToUnlock.add(unlockable);
- }
- }
-
- lockManager.unlock2(true, LockType.WRITE, transaction, detachedObjectsToUnlock, false);
- }
- }
-
protected void computeDirtyObjects(OMMonitor monitor)
{
try
@@ -1355,7 +1323,7 @@ public class TransactionCommitContext implements InternalCommitContext
}
}
- unlockObjects();
+ releaseImplicitLocks();
}
}
@@ -1374,24 +1342,22 @@ public class TransactionCommitContext implements InternalCommitContext
addRevisions(dirtyObjects, monitor.fork());
reviseDetachedObjects(monitor.fork());
- unlockObjects();
+ releaseImplicitLocks();
monitor.worked();
- applyLocksOnNewObjects();
+ acquireLocksOnNewObjects();
monitor.worked();
- if (autoReleaseLocksEnabled)
+ autoReleaseExplicitLocks();
+ monitor.worked();
+
+ if (!postCommitLockStates.isEmpty())
{
- postCommitLockStates = lockManager.unlock2(true, transaction);
- if (!postCommitLockStates.isEmpty())
- {
- // TODO (CD) Does doing this here make sense?
- // The commit notifications get sent later, from postCommit.
- sendLockNotifications(postCommitLockStates);
- }
+ // TODO (CD) Does doing this here make sense?
+ // The commit notifications get sent later, from postCommit.
+ sendLockNotifications(postCommitLockStates);
}
- monitor.worked();
repository.notifyWriteAccessHandlers(transaction, this, false, monitor.fork());
}
catch (Throwable t)
@@ -1404,15 +1370,26 @@ public class TransactionCommitContext implements InternalCommitContext
}
}
- protected void applyLocksOnNewObjects() throws InterruptedException
+ protected synchronized void releaseImplicitLocks()
+ {
+ // Unlock objects locked during commit
+ if (!lockedObjects.isEmpty())
+ {
+ lockManager.unlock2(LockType.WRITE, transaction, lockedObjects);
+ lockedObjects.clear();
+ }
+ }
+
+ protected void acquireLocksOnNewObjects() throws InterruptedException
{
final CDOLockOwner owner = CDOLockUtil.createLockOwner(transaction);
+ final boolean mapIDs = transaction.getRepository().getIDGenerationLocation() == IDGenerationLocation.STORE;
for (CDOLockState lockState : locksOnNewObjects)
{
Object target = lockState.getLockedObject();
- if (transaction.getRepository().getIDGenerationLocation() == IDGenerationLocation.STORE)
+ if (mapIDs)
{
CDOIDAndBranch idAndBranch = target instanceof CDOIDAndBranch ? (CDOIDAndBranch)target : null;
CDOID id = idAndBranch != null ? ((CDOIDAndBranch)target).getID() : (CDOID)target;
@@ -1422,13 +1399,60 @@ public class TransactionCommitContext implements InternalCommitContext
target = idAndBranch != null ? CDOIDUtil.createIDAndBranch(newID, idAndBranch.getBranch()) : newID;
}
+ LockState<Object, IView> postCommitLockState = null;
for (LockType type : LockType.values())
{
if (lockState.isLocked(type, owner, false))
{
- lockManager.lock2(type, transaction, Collections.singleton(target), 0);
+ List<LockState<Object, IView>> lockStates = lockManager.lock2(type, transaction,
+ Collections.singleton(target), 0);
+ postCommitLockState = lockStates.get(0);
}
}
+
+ if (postCommitLockState != null)
+ {
+ postCommitLockStates.add(postCommitLockState);
+ }
+ }
+ }
+
+ protected void autoReleaseExplicitLocks() throws InterruptedException
+ {
+ List<Object> targets = new ArrayList<Object>();
+
+ // Release locks that have been sent from the client.
+ for (CDOID id : idsToUnlock)
+ {
+ Object target = lockManager.getLockKey(id, branch);
+ targets.add(target);
+ }
+
+ // Release durable locks that have been acquired on detached objects.
+ for (CDOID id : detachedObjects)
+ {
+ Object target = lockManager.getLockKey(id, branch);
+ if (lockManager.hasLock(LockType.WRITE, transaction, target))
+ {
+ // We only need to consider detached objects that have been explicitly locked
+ targets.add(target);
+ }
+ }
+
+ try
+ {
+ RWOLockManager.setUnlockAll(true);
+
+ List<LockState<Object, IView>> lockStates = lockManager.unlock2(true, LockType.WRITE, transaction, targets,
+ false);
+ if (lockStates != null)
+ {
+ postCommitLockStates.addAll(lockStates);
+ }
+ }
+ finally
+ {
+ RWOLockManager.setUnlockAll(false);
}
}
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 0151075080..2ddb48c2e3 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
@@ -1022,13 +1022,6 @@ public abstract class SynchronizableRepository extends Repository.Default implem
throw new UnsupportedOperationException();
}
- public Collection<CDOLockState> getLocksOnNewObjects()
- {
- CDOLockState[] locksOnNewObjectsArr = WriteThroughCommitContext.this.getLocksOnNewObjects();
- Collection<CDOLockState> locksOnNewObjects = Arrays.asList(locksOnNewObjectsArr);
- return locksOnNewObjects;
- }
-
public Collection<CDOLob<?>> getLobs()
{
return Collections.emptySet(); // TODO (CD) Did we forget to support this earlier?
@@ -1074,11 +1067,24 @@ public abstract class SynchronizableRepository extends Repository.Default implem
return WriteThroughCommitContext.this.getUserID();
}
+ @Deprecated
public boolean isAutoReleaseLocks()
{
return WriteThroughCommitContext.this.isAutoReleaseLocksEnabled();
}
+ public Collection<CDOLockState> getLocksOnNewObjects()
+ {
+ CDOLockState[] locksOnNewObjectsArray = WriteThroughCommitContext.this.getLocksOnNewObjects();
+ return Arrays.asList(locksOnNewObjectsArray);
+ }
+
+ public Collection<CDOID> getIDsToUnlock()
+ {
+ CDOID[] idsToUnlockArray = WriteThroughCommitContext.this.getIDsToUnlock();
+ return Arrays.asList(idsToUnlockArray);
+ }
+
public String getCommitComment()
{
return WriteThroughCommitContext.this.getCommitComment();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java
index 332a01f1da..1d4f132e69 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IStoreAccessor.java
@@ -312,11 +312,6 @@ public interface IStoreAccessor extends IQueryHandlerProvider, BranchLoader, Com
public long getLastUpdateTime();
/**
- * @since 3.0
- */
- public boolean isAutoReleaseLocksEnabled();
-
- /**
* Returns the temporary, transactional package manager associated with the commit operation represented by this
* <code>CommitContext</code>. In addition to the packages registered with the session this package manager also
* contains the new packages that are part of this commit operation.
@@ -350,14 +345,6 @@ public interface IStoreAccessor extends IQueryHandlerProvider, BranchLoader, Com
public InternalCDOPackageUnit[] getNewPackageUnits();
/**
- * Returns an array of the locks on the new objects that are part of the commit operation represented by this
- * <code>CommitContext</code>.
- *
- * @since 4.1
- */
- public CDOLockState[] getLocksOnNewObjects();
-
- /**
* Returns an array of the new objects that are part of the commit operation represented by this
* <code>CommitContext</code>.
*/
@@ -420,6 +407,27 @@ public interface IStoreAccessor extends IQueryHandlerProvider, BranchLoader, Com
public ExtendedDataInputStream getLobs();
/**
+ *
+ * @since 3.0
+ * @deprecated As of 4.5 no longer supported. See {@link #getIDsToUnlock()}.
+ */
+ @Deprecated
+ public boolean isAutoReleaseLocksEnabled();
+
+ /**
+ * Returns an array of the locks on the new objects that are part of the commit operation represented by this
+ * <code>CommitContext</code>.
+ *
+ * @since 4.1
+ */
+ public CDOLockState[] getLocksOnNewObjects();
+
+ /**
+ * @since 4.6
+ */
+ public CDOID[] getIDsToUnlock();
+
+ /**
* Returns an unmodifiable map from all temporary IDs to their persistent counter parts.
*/
public Map<CDOID, CDOID> getIDMappings();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java
index 786f3af1e3..fd885b81a5 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/spi/server/InternalCommitContext.java
@@ -118,11 +118,6 @@ public interface InternalCommitContext extends IStoreAccessor.CommitContext, CDO
public void setNewPackageUnits(InternalCDOPackageUnit[] newPackageUnits);
- /**
- * @since 4.1
- */
- public void setLocksOnNewObjects(CDOLockState[] locksOnNewObjects);
-
public void setNewObjects(InternalCDORevision[] newObjects);
public void setDirtyObjectDeltas(InternalCDORevisionDelta[] dirtyObjectDeltas);
@@ -144,9 +139,23 @@ public interface InternalCommitContext extends IStoreAccessor.CommitContext, CDO
*/
public void setLastUpdateTime(long lastUpdateTime);
+ /**
+ * @deprecated As of 4.5 no longer supported. See {@link #setIDsToUnlock(CDOID[])}.
+ */
+ @Deprecated
public void setAutoReleaseLocksEnabled(boolean on);
/**
+ * @since 4.1
+ */
+ public void setLocksOnNewObjects(CDOLockState[] locksOnNewObjects);
+
+ /**
+ * @since 4.6
+ */
+ public void setIDsToUnlock(CDOID[] idsToUnlock);
+
+ /**
* @since 4.5
*/
public void setCommitNumber(int commitNumber);
diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
index 51fdfbfdf2..79959cf1d4 100644
--- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.tests;singleton:=true
-Bundle-Version: 4.0.500.qualifier
+Bundle-Version: 4.0.600.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -47,18 +47,18 @@ Export-Package: base;version="4.0.200",
interface_;version="4.0.200",
interface_.impl;version="4.0.200",
interface_.util;version="4.0.200",
- org.eclipse.emf.cdo.tests;version="4.0.500",
- org.eclipse.emf.cdo.tests.bugzilla;version="4.0.500",
- org.eclipse.emf.cdo.tests.bundle;version="4.0.500";x-internal:=true,
- org.eclipse.emf.cdo.tests.config;version="4.0.500",
- org.eclipse.emf.cdo.tests.config.impl;version="4.0.500",
- org.eclipse.emf.cdo.tests.defs;version="4.0.500",
- org.eclipse.emf.cdo.tests.extra;version="4.0.500",
- org.eclipse.emf.cdo.tests.offline;version="4.0.500",
- org.eclipse.emf.cdo.tests.performance;version="4.0.500",
- org.eclipse.emf.cdo.tests.performance.framework;version="4.0.500",
- org.eclipse.emf.cdo.tests.revisioncache;version="4.0.500",
- org.eclipse.emf.cdo.tests.util;version="4.0.500",
+ org.eclipse.emf.cdo.tests;version="4.0.600",
+ org.eclipse.emf.cdo.tests.bugzilla;version="4.0.600",
+ org.eclipse.emf.cdo.tests.bundle;version="4.0.600";x-internal:=true,
+ org.eclipse.emf.cdo.tests.config;version="4.0.600",
+ org.eclipse.emf.cdo.tests.config.impl;version="4.0.600",
+ org.eclipse.emf.cdo.tests.defs;version="4.0.600",
+ org.eclipse.emf.cdo.tests.extra;version="4.0.600",
+ org.eclipse.emf.cdo.tests.offline;version="4.0.600",
+ org.eclipse.emf.cdo.tests.performance;version="4.0.600",
+ org.eclipse.emf.cdo.tests.performance.framework;version="4.0.600",
+ org.eclipse.emf.cdo.tests.revisioncache;version="4.0.600",
+ org.eclipse.emf.cdo.tests.util;version="4.0.600",
reference;version="4.0.200",
reference.impl;version="4.0.200";
x-friends:="org.eclipse.emf.cdo.dawn.tests,
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 0746b51808..775239a919 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
@@ -1255,7 +1255,7 @@ public class LockingManagerTest extends AbstractLockingTest
assertEquals(false, CDOUtil.getCDOObject(category2).cdoWriteLock().isLocked()); // Implicit locks always released
}
- public void testAutoReleaseLocksOnChangedObject() throws Exception
+ public void testAutoReleaseExplicitLocks() throws Exception
{
Company company = getModel1Factory().createCompany();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingNotificationsTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingNotificationsTest.java
index d5a46ec911..c484fbc925 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingNotificationsTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingNotificationsTest.java
@@ -309,8 +309,10 @@ public class LockingNotificationsTest extends AbstractLockingTest
CDOTransaction tx1 = session1.openTransaction();
tx1.options().setAutoReleaseLocksEnabled(true);
+
CDOResource res1 = tx1.getOrCreateResource(getResourcePath("r1"));
res1.getContents().clear();
+
Company company = getModel1Factory().createCompany();
res1.getContents().add(company);
tx1.commit();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
index bdebdba5b6..6721079c85 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/SessionTest.java
@@ -63,6 +63,14 @@ public class SessionTest extends AbstractCDOTest
private static final char[] PASSWORD2 = "invalid".toCharArray(); //$NON-NLS-1$
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ enableConsole();
+
+ }
+
public void testIsSupportingAudits() throws Exception
{
CDOSession session = openSession();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355045_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355045_Test.java
new file mode 100644
index 0000000000..fad9c66cd3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_355045_Test.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Esteban Dugueperoux - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.CDOState;
+import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+
+import org.junit.Assert;
+
+import java.util.Collections;
+
+/**
+ * @author Esteban Dugueperoux
+ */
+public class Bugzilla_355045_Test extends AbstractCDOTest
+{
+ private static final String RESOURCE_PATH = "/test1";
+
+ private CDOTransaction transaction;
+
+ private Company company;
+
+ private Category category1;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ CDOSession cdoSession = openSession();
+ cdoSession.options().setLockNotificationMode(LockNotificationMode.ALWAYS);
+ transaction = cdoSession.openTransaction();
+ // cdoTransaction.options().setAutoReleaseLocksEnabled(false);
+ CDOResource cdoResource = transaction.createResource(getResourcePath(RESOURCE_PATH));
+
+ company = getModel1Factory().createCompany();
+ category1 = getModel1Factory().createCategory();
+ company.getCategories().add(category1);
+
+ cdoResource.getContents().add(company);
+ cdoResource.save(Collections.emptyMap());
+ }
+
+ public void testLockOnCommitOfSingleNewObject() throws Exception
+ {
+ Category category2 = getModel1Factory().createCategory();
+ category2.setName("category2");
+ category1.getCategories().add(category2);
+
+ transaction.lockObjects(CDOUtil.getCDOObjects(category2), LockType.WRITE, DEFAULT_TIMEOUT);
+ transaction.options().addAutoReleaseLocksExemptions(true, category2);
+ assertLockStatus(category2, true, false);
+
+ transaction.commit();
+ assertEquals(CDOState.CLEAN, CDOUtil.getCDOObject(category2).cdoState());
+ assertLockStatus(category2, true, false);
+ }
+
+ public void testRecursiveLockOnCommitOfNewObjectsTree() throws Exception
+ {
+ Category category2 = getModel1Factory().createCategory();
+ category2.setName("category2");
+ Category category4 = getModel1Factory().createCategory();
+ category4.setName("category4");
+ Category category5 = getModel1Factory().createCategory();
+ category5.setName("category5");
+ Category category6 = getModel1Factory().createCategory();
+ category6.setName("category6");
+ Category category7 = getModel1Factory().createCategory();
+ category7.setName("category7");
+
+ category2.getCategories().add(category4);
+ category2.getCategories().add(category5);
+ category4.getCategories().add(category6);
+ category5.getCategories().add(category7);
+ category1.getCategories().add(category2);
+
+ Category category3 = getModel1Factory().createCategory();
+ category3.setName("category3");
+ Category category8 = getModel1Factory().createCategory();
+ category8.setName("category8");
+ Category category9 = getModel1Factory().createCategory();
+ category9.setName("category9");
+ Category category10 = getModel1Factory().createCategory();
+ category10.setName("category10");
+ Category category11 = getModel1Factory().createCategory();
+ category11.setName("category11");
+
+ category3.getCategories().add(category8);
+ category3.getCategories().add(category9);
+ category8.getCategories().add(category10);
+ category9.getCategories().add(category11);
+ category1.getCategories().add(category3);
+
+ transaction.lockObjects(CDOUtil.getCDOObjects(category2), LockType.WRITE, DEFAULT_TIMEOUT, true);
+ transaction.options().addAutoReleaseLocksExemptions(true, category2);
+
+ assertLockStatus(category1, false, false);
+ assertLockStatus(category2, true, true);
+ assertLockStatus(category3, false, true);
+
+ transaction.lockObjects(CDOUtil.getCDOObjects(category3), LockType.WRITE, DEFAULT_TIMEOUT, true);
+ transaction.options().addAutoReleaseLocksExemptions(true, category3);
+
+ assertLockStatus(category1, false, false);
+ assertLockStatus(category2, true, true);
+ assertLockStatus(category3, true, true);
+
+ transaction.unlockObjects(CDOUtil.getCDOObjects(category3), LockType.WRITE);
+
+ assertLockStatus(category1, false, false);
+ assertLockStatus(category2, true, true);
+ assertLockStatus(category3, false, false);
+ assertLockStatus(category8, true, true);
+ assertLockStatus(category9, true, true);
+
+ transaction.commit();
+
+ assertLockStatus(category1, false, false);
+ assertLockStatus(category2, true, true);
+ assertLockStatus(category3, false, false);
+ assertLockStatus(category8, true, true);
+ assertLockStatus(category9, true, true);
+ }
+
+ public void testRecursiveLockOfObjectsTreeContainingASubTreeOfNewObjects() throws Exception
+ {
+ Category category2 = getModel1Factory().createCategory();
+ category2.setName("category2");
+ Category category4 = getModel1Factory().createCategory();
+ category4.setName("category4");
+ Category category5 = getModel1Factory().createCategory();
+ category5.setName("category5");
+ Category category6 = getModel1Factory().createCategory();
+ category6.setName("category6");
+ Category category7 = getModel1Factory().createCategory();
+ category7.setName("category7");
+
+ category2.getCategories().add(category4);
+ category2.getCategories().add(category5);
+ category4.getCategories().add(category6);
+ category5.getCategories().add(category7);
+ category1.getCategories().add(category2);
+
+ Category category3 = getModel1Factory().createCategory();
+ category3.setName("category3");
+ Category category8 = getModel1Factory().createCategory();
+ category8.setName("category8");
+ Category category9 = getModel1Factory().createCategory();
+ category9.setName("category9");
+ Category category10 = getModel1Factory().createCategory();
+ category10.setName("category10");
+ Category category11 = getModel1Factory().createCategory();
+ category11.setName("category11");
+
+ category3.getCategories().add(category8);
+ category3.getCategories().add(category9);
+ category8.getCategories().add(category10);
+ category9.getCategories().add(category11);
+ category1.getCategories().add(category3);
+
+ transaction.lockObjects(CDOUtil.getCDOObjects(category1), LockType.WRITE, DEFAULT_TIMEOUT, true);
+ transaction.options().addAutoReleaseLocksExemptions(false, category1);
+ assertLockStatus(category1, true, false);
+
+ transaction.commit();
+ assertLockStatus(category1, true, false);
+ }
+
+ private void assertLockStatus(Category category, boolean lockedByMe, boolean recursive)
+ {
+ CDOObject categoryCDOObject = CDOUtil.getCDOObject(category);
+ CDOLockState cdoLockState = categoryCDOObject.cdoLockState();
+ Assert.assertEquals(
+ "new object " + category.getName()
+ + (lockedByMe ? " should be locally locked" : " shouldn't be locally locked"),
+ lockedByMe, cdoLockState.isLocked(LockType.WRITE, transaction, false));
+
+ if (recursive)
+ {
+ for (Category subCategory : category.getCategories())
+ {
+ assertLockStatus(subCategory, lockedByMe, recursive);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563_Test.java
new file mode 100644
index 0000000000..2a93570d3d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563_Test.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Esteban Dugueperoux - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.CDOCommonSession.Options.LockNotificationMode;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
+import org.eclipse.net4j.util.io.IOUtil;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Esteban Dugueperoux
+ */
+public class Bugzilla_387563_Test extends AbstractCDOTest
+{
+ private CDOTransaction transaction;
+
+ private Company company;
+
+ private Category category1;
+
+ private Category category2;
+
+ private Category category3;
+
+ private Category category4;
+
+ private Category category5;
+
+ @Override
+ protected void doSetUp() throws Exception
+ {
+ super.doSetUp();
+
+ CDOSession session = openSession();
+ session.options().setLockNotificationMode(LockNotificationMode.ALWAYS);
+
+ transaction = session.openTransaction();
+ // transaction.options().setAutoReleaseLocksEnabled(false);
+
+ CDOResource resource = transaction.createResource(getResourcePath("test1"));
+
+ category1 = getModel1Factory().createCategory();
+ category1.setName("category1");
+
+ category2 = getModel1Factory().createCategory();
+ category2.setName("category2");
+
+ category3 = getModel1Factory().createCategory();
+ category3.setName("category3");
+
+ category4 = getModel1Factory().createCategory();
+ category4.setName("category4");
+
+ category5 = getModel1Factory().createCategory();
+ category5.setName("category5");
+
+ Category category6 = getModel1Factory().createCategory();
+ category6.setName("category6");
+
+ Category category7 = getModel1Factory().createCategory();
+ category7.setName("category7");
+
+ Category category8 = getModel1Factory().createCategory();
+ category8.setName("category8");
+
+ Category category9 = getModel1Factory().createCategory();
+ category9.setName("category9");
+
+ Category category10 = getModel1Factory().createCategory();
+ category10.setName("category10");
+
+ Category category11 = getModel1Factory().createCategory();
+ category11.setName("category11");
+
+ category1.getCategories().add(category2);
+ category1.getCategories().add(category3);
+ category2.getCategories().add(category4);
+ category2.getCategories().add(category5);
+ category3.getCategories().add(category8);
+ category3.getCategories().add(category9);
+ category4.getCategories().add(category6);
+ category5.getCategories().add(category7);
+ category8.getCategories().add(category10);
+ category9.getCategories().add(category11);
+
+ company = getModel1Factory().createCompany();
+ company.getCategories().add(category1);
+
+ resource.getContents().add(company);
+
+ log("", Collections.singletonList(category1));
+ }
+
+ public void testPartialLockOnCommit() throws Exception
+ {
+ transaction.lockObjects(CDOUtil.getCDOObjects(category1), LockType.WRITE, DEFAULT_TIMEOUT, true);
+
+ // Mark all objects to stay locked on commit
+ transaction.options().addAutoReleaseLocksExemptions(true, category1);
+ assertLockStatus(category1, true, true);
+
+ // Mark category2 to be unlocked on commit
+ transaction.options().removeAutoReleaseLocksExemptions(false, category2);
+ assertLockStatus(category1, true, true);
+
+ // Mark category3 and its descendants to be unlocked on commit
+ transaction.options().removeAutoReleaseLocksExemptions(true, category3);
+ assertLockStatus(category1, true, true);
+
+ transaction.commit();
+ assertLockStatus(category1, true, false);
+ assertLockStatus(category2, false, false);
+ assertLockStatus(category3, false, true);
+ assertLockStatus(category4, true, true);
+ assertLockStatus(category5, true, true);
+ }
+
+ public void testPartialUnlockOnCommit() throws Exception
+ {
+ transaction.lockObjects(CDOUtil.getCDOObjects(category1), LockType.WRITE, DEFAULT_TIMEOUT, true);
+
+ // Mark category1 and its descendants to stay locked on commit
+ transaction.options().addAutoReleaseLocksExemptions(true, category1);
+ assertLockStatus(category1, true, true);
+
+ transaction.unlockObjects(CDOUtil.getCDOObjects(category3), LockType.WRITE, true);
+ assertLockStatus(category3, false, true);
+
+ transaction.commit();
+ assertLockStatus(category1, true, false);
+ assertLockStatus(category2, true, true);
+ assertLockStatus(category3, false, true);
+ }
+
+ private static void assertLockStatus(Category category, boolean expected, boolean recursive)
+ {
+ CDOObject cdoObject = CDOUtil.getCDOObject(category);
+ CDOLockState lockState = cdoObject.cdoLockState();
+
+ assertEquals(
+ "new object " + category.getName() + (expected ? " should be locally locked" : " shouldn't be locally locked."),
+ expected, lockState.isLocked(LockType.WRITE, cdoObject.cdoView(), false));
+
+ if (recursive)
+ {
+ for (Category subCategory : category.getCategories())
+ {
+ assertLockStatus(subCategory, expected, recursive);
+ }
+ }
+ }
+
+ private static void log(String indent, List<Category> categories)
+ {
+ for (Category category : categories)
+ {
+ IOUtil.OUT().println(indent + category.getName() + " --> " + CDOUtil.getCDOObject(category).cdoID());
+ log(indent + " ", category.getCategories());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563b_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563b_Test.java
new file mode 100644
index 0000000000..31baf15857
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_387563b_Test.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2016 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractLockingTest;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+/**
+ * @author Eike Stepper
+ */
+public class Bugzilla_387563b_Test extends AbstractLockingTest
+{
+ public void testNoImplicitLockingOfNewObject() throws Exception
+ {
+ Company company = getModel1Factory().createCompany();
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.options().setAutoReleaseLocksEnabled(true);
+
+ CDOResource resource = transaction.createResource(getResourcePath("test1"));
+ resource.getContents().add(company);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject(company);
+ CDOLockState lockState = cdoObject.cdoLockState();
+ assertNull(lockState.getWriteLockOwner());
+
+ transaction.commit();
+ assertWriteLock(false, company);
+ }
+
+ public void testExplicitLockingOfNewObject() throws Exception
+ {
+ Company company = getModel1Factory().createCompany();
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.options().setAutoReleaseLocksEnabled(true);
+
+ CDOResource resource = transaction.createResource(getResourcePath("test1"));
+ resource.getContents().add(company);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject(company);
+ cdoObject.cdoWriteLock().lock();
+
+ CDOLockState lockState = cdoObject.cdoLockState();
+ assertEquals(transaction, lockState.getWriteLockOwner());
+
+ transaction.commit();
+ assertWriteLock(false, company);
+ }
+
+ public void testExplicitLockingOfNewObjectExemption() throws Exception
+ {
+ Company company = getModel1Factory().createCompany();
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.options().setAutoReleaseLocksEnabled(true);
+ transaction.options().addAutoReleaseLocksExemptions(false, company);
+
+ CDOResource resource = transaction.createResource(getResourcePath("test1"));
+ resource.getContents().add(company);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject(company);
+ cdoObject.cdoWriteLock().lock();
+
+ CDOLockState lockState = cdoObject.cdoLockState();
+ assertEquals(transaction, lockState.getWriteLockOwner());
+
+ transaction.commit();
+ assertWriteLock(true, company);
+ }
+
+ public void testExplicitLockingAndUnlockingOfNewObject() throws Exception
+ {
+ Company company = getModel1Factory().createCompany();
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.options().setAutoReleaseLocksEnabled(true);
+ transaction.options().addAutoReleaseLocksExemptions(false, company);
+
+ CDOResource resource = transaction.createResource(getResourcePath("test1"));
+ resource.getContents().add(company);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject(company);
+ cdoObject.cdoWriteLock().lock();
+
+ CDOLockState lockState = cdoObject.cdoLockState();
+ assertEquals(transaction, lockState.getWriteLockOwner());
+
+ cdoObject.cdoWriteLock().unlock();
+ lockState = cdoObject.cdoLockState();
+ assertNull(lockState.getWriteLockOwner());
+
+ transaction.commit();
+ assertWriteLock(false, company);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_466951_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_466951_Test.java
index 0957d57d57..a6fcb011b5 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_466951_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_466951_Test.java
@@ -28,8 +28,6 @@ import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.junit.Assert;
-
import java.util.Collections;
/**
@@ -56,77 +54,78 @@ public class Bugzilla_466951_Test extends AbstractCDOTest
ISignalProtocol<?> protocol = ((org.eclipse.emf.cdo.net4j.CDONet4jSession)session1).options().getNet4jProtocol();
SignalCounter signalCounter = new SignalCounter(protocol);
- int nbLockStateRequest = signalCounter.getCountFor(LockStateRequest.class);
- assertEquals(0, nbLockStateRequest);
-
- CDOObject companyCDOObject = CDOUtil.getCDOObject(company);
- CDOLockState lockState = companyCDOObject.cdoLockState();
- Object expectedLockedObject = companyCDOObject.cdoID();
- if (session1.getRepositoryInfo().isSupportingBranches())
- {
- expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject.cdoID(), transaction1.getBranch());
- }
-
- assertEquals(expectedLockedObject, lockState.getLockedObject());
- Assert.assertTrue(lockState.getReadLockOwners().isEmpty());
- assertNull(lockState.getWriteLockOwner());
- assertNull(lockState.getWriteOptionOwner());
- transaction1.lockObjects(Collections.singleton(companyCDOObject), LockType.WRITE, -1);
-
- lockState = companyCDOObject.cdoLockState();
- expectedLockedObject = companyCDOObject.cdoID();
- if (session1.getRepositoryInfo().isSupportingBranches())
+ try
{
- expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject.cdoID(), transaction1.getBranch());
+ assertEquals(0, signalCounter.removeCountFor(LockStateRequest.class));
+
+ CDOObject companyCDOObject = CDOUtil.getCDOObject(company);
+ CDOLockState lockState = companyCDOObject.cdoLockState();
+ Object expectedLockedObject = companyCDOObject.cdoID();
+ if (session1.getRepositoryInfo().isSupportingBranches())
+ {
+ expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject.cdoID(), transaction1.getBranch());
+ }
+
+ assertEquals(expectedLockedObject, lockState.getLockedObject());
+ assertTrue(lockState.getReadLockOwners().isEmpty());
+ assertNull(lockState.getWriteLockOwner());
+ assertNull(lockState.getWriteOptionOwner());
+
+ transaction1.lockObjects(Collections.singleton(companyCDOObject), LockType.WRITE, -1);
+
+ lockState = companyCDOObject.cdoLockState();
+ expectedLockedObject = companyCDOObject.cdoID();
+ if (session1.getRepositoryInfo().isSupportingBranches())
+ {
+ expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject.cdoID(), transaction1.getBranch());
+ }
+
+ assertEquals(expectedLockedObject, lockState.getLockedObject());
+ assertTrue(lockState.getReadLockOwners().isEmpty());
+ assertEquals(transaction1, lockState.getWriteLockOwner());
+ assertNull(lockState.getWriteOptionOwner());
+
+ EcoreUtil.delete(company);
+ assertEquals(CDOState.TRANSIENT, companyCDOObject.cdoState());
+ lockState = companyCDOObject.cdoLockState();
+ assertNull(lockState);
+
+ Company company2 = getModel1Factory().createCompany();
+ resource1.getContents().add(company2);
+
+ CDOObject companyCDOObject2 = CDOUtil.getCDOObject(company2);
+ lockState = companyCDOObject2.cdoLockState();
+ expectedLockedObject = companyCDOObject2.cdoID();
+ if (session1.getRepositoryInfo().isSupportingBranches())
+ {
+ expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject2.cdoID(), transaction1.getBranch());
+ }
+
+ assertEquals(expectedLockedObject, lockState.getLockedObject());
+ assertTrue(lockState.getReadLockOwners().isEmpty());
+ assertNull(lockState.getWriteLockOwner());
+ assertNull(lockState.getWriteOptionOwner());
+ assertEquals(0, signalCounter.removeCountFor(LockStateRequest.class));
+
+ transaction1.commit();
+
+ lockState = companyCDOObject2.cdoLockState();
+ expectedLockedObject = companyCDOObject2.cdoID();
+ if (session1.getRepositoryInfo().isSupportingBranches())
+ {
+ expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject2.cdoID(), transaction1.getBranch());
+ }
+
+ assertEquals(expectedLockedObject, lockState.getLockedObject());
+ assertTrue(lockState.getReadLockOwners().isEmpty());
+ assertNull(lockState.getWriteLockOwner());
+ assertNull(lockState.getWriteOptionOwner());
+ assertEquals(0, signalCounter.removeCountFor(LockStateRequest.class));
}
-
- assertEquals(expectedLockedObject, lockState.getLockedObject());
- Assert.assertTrue(lockState.getReadLockOwners().isEmpty());
- assertEquals(transaction1, lockState.getWriteLockOwner());
- assertNull(lockState.getWriteOptionOwner());
-
- EcoreUtil.delete(company);
- assertEquals(CDOState.TRANSIENT, companyCDOObject.cdoState());
- lockState = companyCDOObject.cdoLockState();
- assertNull(lockState);
-
- Company company2 = getModel1Factory().createCompany();
- resource1.getContents().add(company2);
-
- CDOObject companyCDOObject2 = CDOUtil.getCDOObject(company2);
- lockState = companyCDOObject2.cdoLockState();
- expectedLockedObject = companyCDOObject2.cdoID();
- if (session1.getRepositoryInfo().isSupportingBranches())
+ finally
{
- expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject2.cdoID(), transaction1.getBranch());
+ signalCounter.dispose();
}
-
- assertEquals(expectedLockedObject, lockState.getLockedObject());
- Assert.assertTrue(lockState.getReadLockOwners().isEmpty());
- assertNull(lockState.getWriteLockOwner());
- assertNull(lockState.getWriteOptionOwner());
-
- nbLockStateRequest = signalCounter.getCountFor(LockStateRequest.class);
- assertEquals(0, nbLockStateRequest);
-
- transaction1.commit();
-
- lockState = companyCDOObject2.cdoLockState();
- expectedLockedObject = companyCDOObject2.cdoID();
- if (session1.getRepositoryInfo().isSupportingBranches())
- {
- expectedLockedObject = CDOIDUtil.createIDAndBranch(companyCDOObject2.cdoID(), transaction1.getBranch());
- }
-
- assertEquals(expectedLockedObject, lockState.getLockedObject());
- Assert.assertTrue(lockState.getReadLockOwners().isEmpty());
- assertNull(lockState.getWriteLockOwner());
- assertNull(lockState.getWriteOptionOwner());
-
- nbLockStateRequest = signalCounter.getCountFor(LockStateRequest.class);
- assertEquals(0, nbLockStateRequest);
-
- protocol.removeListener(signalCounter);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
index fc258b6e14..575ed4ced0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.ui;singleton:=true
-Bundle-Version: 4.5.0.qualifier
+Bundle-Version: 4.5.100.qualifier
Bundle-Activator: org.eclipse.emf.cdo.internal.ui.bundle.OM$Activator
Bundle-Vendor: %providerName
Bundle-ClassPath: .
@@ -27,7 +27,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";reso
org.eclipse.emf.ecp.edit;bundle-version="[1.5.0,2.0.0)";resolution:=optional,
org.eclipse.emf.ecp.edit.swt;bundle-version="[1.5.0,2.0.0)";resolution:=optional,
org.eclipse.emf.ecp.ui.view.swt;bundle-version="[1.5.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
+Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -37,7 +37,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.actions;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.actions;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -47,7 +47,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.handlers;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.handlers;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -57,9 +57,9 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.actions.delegates;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.ui.bundle;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.internal.ui.dialogs;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.actions.delegates;version="4.5.100";x-internal:=true,
+ org.eclipse.emf.cdo.internal.ui.bundle;version="4.5.100";x-internal:=true,
+ org.eclipse.emf.cdo.internal.ui.dialogs;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -69,7 +69,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.dnd;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.dnd;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -79,7 +79,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.editor;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.editor;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -89,7 +89,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.filters;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.filters;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -99,7 +99,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.history;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.history;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -109,7 +109,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.messages;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.messages;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -119,7 +119,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.perspectives;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.perspectives;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -129,7 +129,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.preferences;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.preferences;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -139,7 +139,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.transfer;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.transfer;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -149,7 +149,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.views;version="4.5.0";
+ org.eclipse.emf.cdo.internal.ui.views;version="4.5.100";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -159,5 +159,5 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.5.0";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.ui;version="4.5.0",
- org.eclipse.emf.cdo.ui.widgets;version="4.5.0"
+ org.eclipse.emf.cdo.ui;version="4.5.100",
+ org.eclipse.emf.cdo.ui.widgets;version="4.5.100"
diff --git a/plugins/org.eclipse.emf.cdo.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
index 3f9cb46f1e..cdd6485193 100644
--- a/plugins/org.eclipse.emf.cdo.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
@@ -411,7 +411,6 @@
</iterate>
</with>
</visibleWhen>
-
</command>
<command
commandId="org.eclipse.emf.cdo.ui.UnlockObject"
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java
index 0af905748a..9966a073fd 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java
@@ -30,7 +30,9 @@ import java.util.List;
/**
* @author Simon McDuff
+ * @deprecated As of 4.6 no longer supported.
*/
+@Deprecated
public abstract class AbstractLockObjectsAction extends EditingDomainAction
{
private List<InternalCDOObject> objects = new ArrayList<InternalCDOObject>();
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AutoReleaseLockExemptionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AutoReleaseLockExemptionAction.java
new file mode 100644
index 0000000000..794f1cf0a9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AutoReleaseLockExemptionAction.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * @author Eike Stepper
+ */
+public class AutoReleaseLockExemptionAction extends EditingDomainAction
+{
+ public static final String ID = "AutoReleaseLockExemption"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("AutoReleaseLockExemptionAction.1"); //$NON-NLS-1$
+
+ private CDOObject selectedObject;
+
+ public AutoReleaseLockExemptionAction()
+ {
+ super(TITLE);
+ setId(ID);
+ }
+
+ public void selectionChanged(IStructuredSelection selection)
+ {
+ selectedObject = null;
+
+ if (selection != null && selection.size() == 1)
+ {
+ Object element = selection.getFirstElement();
+ if (element instanceof EObject)
+ {
+ EObject object = (EObject)element;
+ selectedObject = CDOUtil.getCDOObject(object);
+ }
+ }
+ }
+
+ public boolean init()
+ {
+ if (selectedObject != null && selectedObject.cdoWriteLock().isLocked())
+ {
+ CDOTransaction transaction = (CDOTransaction)selectedObject.cdoView();
+ setChecked(transaction.options().isAutoReleaseLocksExemption(selectedObject));
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public void update()
+ {
+ setEnabled(true);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ if (selectedObject != null)
+ {
+ CDOTransaction transaction = (CDOTransaction)selectedObject.cdoView();
+ if (transaction.options().isAutoReleaseLocksExemption(selectedObject))
+ {
+ transaction.options().removeAutoReleaseLocksExemptions(false, selectedObject);
+ }
+ else
+ {
+ transaction.options().addAutoReleaseLocksExemptions(false, selectedObject);
+ }
+ }
+
+ update();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java
index b42596924f..ff5c91113b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java
@@ -24,7 +24,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
* {@link CDOSession session}.
*
* @author Victor Roldan Betancort
+ * @deprecated As of 4.6 no longer supported.
*/
+@Deprecated
public class ChangePassiveUpdateAction extends EditingDomainAction
{
public static final String ID = "change-passiveupdate"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java
index b2be9b79c2..707ccb2b26 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java
@@ -19,7 +19,9 @@ import org.eclipse.emf.spi.cdo.InternalCDOObject;
/**
* @author Simon McDuff
+ * @deprecated As of 4.6 no longer supported.
*/
+@Deprecated
public class ReadLockObjectsAction extends AbstractLockObjectsAction
{
public static final String ID = "readlock-objects"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java
index a96f14771d..3f418f7bc9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java
@@ -19,7 +19,9 @@ import org.eclipse.emf.spi.cdo.InternalCDOObject;
/**
* @author Simon McDuff
+ * @deprecated As of 4.6 no longer supported.
*/
+@Deprecated
public class WriteLockObjectsAction extends AbstractLockObjectsAction
{
public static final String ID = "writelock-objects"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
index f5977d7f87..2e6e898465 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
@@ -12,12 +12,8 @@
package org.eclipse.emf.cdo.internal.ui.editor;
import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.ui.actions.ChangePassiveUpdateAction;
+import org.eclipse.emf.cdo.internal.ui.actions.AutoReleaseLockExemptionAction;
import org.eclipse.emf.cdo.internal.ui.actions.ImportRootsAction;
-import org.eclipse.emf.cdo.internal.ui.actions.ReadLockObjectsAction;
-import org.eclipse.emf.cdo.internal.ui.actions.WriteLockObjectsAction;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.emf.edit.domain.EditingDomain;
@@ -76,17 +72,7 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
/**
* @ADDED
*/
- protected ReadLockObjectsAction readLockObjectsAction;
-
- /**
- * @ADDED
- */
- protected WriteLockObjectsAction writeLockObjectsAction;
-
- /**
- * @ADDED
- */
- protected ChangePassiveUpdateAction changePassiveUpdateAction;
+ protected AutoReleaseLockExemptionAction autoReleaseLockExemptionAction;
/**
* This keeps track of the active editor.
@@ -196,12 +182,7 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
loadResourceAction.setId(LOAD_RESOURCE_ID);
importRootsAction = new ImportRootsAction();
- importRootsAction.setId(ImportRootsAction.ID);
-
- changePassiveUpdateAction = new ChangePassiveUpdateAction();
-
- readLockObjectsAction = new ReadLockObjectsAction();
- writeLockObjectsAction = new WriteLockObjectsAction();
+ autoReleaseLockExemptionAction = new AutoReleaseLockExemptionAction();
validateAction = new ValidateAction();
controlAction = new ControlAction();
@@ -375,18 +356,10 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection)
{
- if (readLockObjectsAction != null)
- {
- readLockObjectsAction.selectionChanged((IStructuredSelection)selection);
- }
-
- if (writeLockObjectsAction != null)
- {
- writeLockObjectsAction.selectionChanged((IStructuredSelection)selection);
- }
-
if (((IStructuredSelection)selection).size() == 1)
{
+ autoReleaseLockExemptionAction.selectionChanged((IStructuredSelection)selection);
+
Object object = ((IStructuredSelection)selection).getFirstElement();
EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
@@ -394,16 +367,13 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
newChildDescriptors = domain.getNewChildDescriptors(object, null);
newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
- if (importRootsAction != null)
+ if (object instanceof CDOResource)
{
- if (object instanceof CDOResource)
- {
- importRootsAction.setTargetResource((CDOResource)object);
- }
- else
- {
- importRootsAction.setTargetResource(null);
- }
+ importRootsAction.setTargetResource((CDOResource)object);
+ }
+ else
+ {
+ importRootsAction.setTargetResource(null);
}
}
}
@@ -578,37 +548,21 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
refreshViewerAction.setId(REFRESH_VIEWER_ID);
menuManager.insertAfter("ui-actions", refreshViewerAction); //$NON-NLS-1$
- MenuManager lockingSubMenu = new MenuManager(Messages.getString("CDOActionBarContributor_0")); //$NON-NLS-1$
- lockingSubMenu.add(new Separator("ui-actions")); //$NON-NLS-1$
-
- lockingSubMenu.insertAfter("ui-actions", writeLockObjectsAction); //$NON-NLS-1$
- writeLockObjectsAction.update();
-
- lockingSubMenu.insertAfter("ui-actions", readLockObjectsAction); //$NON-NLS-1$
- readLockObjectsAction.update();
-
- menuManager.insertAfter("ui-actions", lockingSubMenu); //$NON-NLS-1$
-
- menuManager.insertAfter("ui-actions", changePassiveUpdateAction); //$NON-NLS-1$
- changePassiveUpdateAction.update();
- changePassiveUpdateAction.setEnabled(true);
+ if (autoReleaseLockExemptionAction.init())
+ {
+ menuManager.insertAfter("additions", autoReleaseLockExemptionAction); //$NON-NLS-1$
+ autoReleaseLockExemptionAction.update();
+ }
super.addGlobalActions(menuManager);
if (loadResourceAction != null)
{
- if (importRootsAction != null)
- {
- menuManager.insertAfter(loadResourceAction.getId(), importRootsAction);
- }
+ menuManager.insertAfter(loadResourceAction.getId(), importRootsAction);
}
else
{
- if (importRootsAction != null)
- {
- menuManager.insertBefore("additions-end", importRootsAction); //$NON-NLS-1$
- }
-
+ menuManager.insertBefore("additions-end", importRootsAction); //$NON-NLS-1$
menuManager.insertBefore("additions-end", new Separator()); //$NON-NLS-1$
}
}
@@ -631,28 +585,15 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
@Override
public void activate()
{
- if (importRootsAction != null)
+ importRootsAction.setActiveWorkbenchPart(activeEditor);
+ Object input = ((CDOEditor)getActiveEditor()).getViewer().getInput();
+ if (input instanceof CDOResource)
{
- importRootsAction.setActiveWorkbenchPart(activeEditor);
- Object input = ((CDOEditor)getActiveEditor()).getViewer().getInput();
- if (input instanceof CDOResource)
- {
- importRootsAction.setTargetResource((CDOResource)input);
- }
- else
- {
- importRootsAction.setTargetResource(null);
- }
+ importRootsAction.setTargetResource((CDOResource)input);
}
-
- if (changePassiveUpdateAction != null)
+ else
{
- Object input = ((CDOEditor)getActiveEditor()).getViewer().getInput();
- if (input instanceof CDOResource)
- {
- CDOView view = ((CDOResource)input).cdoView();
- changePassiveUpdateAction.setSession(view.getSession());
- }
+ importRootsAction.setTargetResource(null);
}
super.activate();
@@ -664,11 +605,8 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
@Override
public void deactivate()
{
- if (importRootsAction != null)
- {
- importRootsAction.setActiveWorkbenchPart(null);
- importRootsAction.setTargetResource(null);
- }
+ importRootsAction.setActiveWorkbenchPart(null);
+ importRootsAction.setTargetResource(null);
super.deactivate();
}
@@ -680,9 +618,6 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
public void update()
{
super.update();
- if (importRootsAction != null)
- {
- importRootsAction.update();
- }
+ importRootsAction.update();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
index 6f4045eb55..0c5302e65c 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
@@ -91,6 +91,7 @@ CDOWatchListView.7=Remove all subscriptions
CDOWatchListView.8=Reset Changes
CDOWatchListView.9=Reset all change notifications from the selected subscriptions
ChangePassiveUpdateAction.1=Passive Updates
+AutoReleaseLockExemptionAction.1=Auto Release Lock Exemption
ChangePasswordAction_0=Change Password...
ChangePasswordAction_1=Change the connected user's password
CloseSessionAction.0=Close
diff --git a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
index f2978ba366..175d5a6fc3 100644
--- a/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo; singleton:=true
-Bundle-Version: 4.5.0.qualifier
+Bundle-Version: 4.6.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,29 +10,29 @@ Bundle-Activator: org.eclipse.emf.internal.cdo.bundle.Activator$Implementation
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";resolution:=optional,
org.eclipse.emf.cdo.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo;version="4.5.0",
- org.eclipse.emf.cdo.eresource;version="4.5.0",
- org.eclipse.emf.cdo.eresource.impl;version="4.5.0",
- org.eclipse.emf.cdo.eresource.util;version="4.5.0",
- org.eclipse.emf.cdo.eresource.validation;version="4.5.0",
- org.eclipse.emf.cdo.etypes;version="4.5.0",
- org.eclipse.emf.cdo.etypes.impl;version="4.5.0",
- org.eclipse.emf.cdo.etypes.util;version="4.5.0",
- org.eclipse.emf.cdo.session;version="4.5.0",
- org.eclipse.emf.cdo.session.remote;version="4.5.0",
- org.eclipse.emf.cdo.transaction;version="4.5.0",
- org.eclipse.emf.cdo.util;version="4.5.0",
- org.eclipse.emf.cdo.view;version="4.5.0",
- org.eclipse.emf.internal.cdo;version="4.5.0",
- org.eclipse.emf.internal.cdo.analyzer;version="4.5.0";
+Export-Package: org.eclipse.emf.cdo;version="4.6.0",
+ org.eclipse.emf.cdo.eresource;version="4.6.0",
+ org.eclipse.emf.cdo.eresource.impl;version="4.6.0",
+ org.eclipse.emf.cdo.eresource.util;version="4.6.0",
+ org.eclipse.emf.cdo.eresource.validation;version="4.6.0",
+ org.eclipse.emf.cdo.etypes;version="4.6.0",
+ org.eclipse.emf.cdo.etypes.impl;version="4.6.0",
+ org.eclipse.emf.cdo.etypes.util;version="4.6.0",
+ org.eclipse.emf.cdo.session;version="4.6.0",
+ org.eclipse.emf.cdo.session.remote;version="4.6.0",
+ org.eclipse.emf.cdo.transaction;version="4.6.0",
+ org.eclipse.emf.cdo.util;version="4.6.0",
+ org.eclipse.emf.cdo.view;version="4.6.0",
+ org.eclipse.emf.internal.cdo;version="4.6.0",
+ org.eclipse.emf.internal.cdo.analyzer;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.bundle;version="4.5.0";x-friends:="org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.messages;version="4.5.0";x-internal:=true,
- org.eclipse.emf.internal.cdo.object;version="4.5.0";
+ org.eclipse.emf.internal.cdo.bundle;version="4.6.0";x-friends:="org.eclipse.emf.cdo.ui",
+ org.eclipse.emf.internal.cdo.messages;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.internal.cdo.object;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
@@ -42,14 +42,14 @@ Export-Package: org.eclipse.emf.cdo;version="4.5.0",
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.edit",
- org.eclipse.emf.internal.cdo.query;version="4.5.0";
+ org.eclipse.emf.internal.cdo.query;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.tests.objectivity",
- org.eclipse.emf.internal.cdo.session;version="4.5.0";
+ org.eclipse.emf.internal.cdo.session;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
@@ -60,26 +60,26 @@ Export-Package: org.eclipse.emf.cdo;version="4.5.0",
org.eclipse.emf.cdo.security.ui,
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.internal.cdo.session.remote;version="4.5.0";
+ org.eclipse.emf.internal.cdo.session.remote;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.transaction;version="4.5.0";
+ org.eclipse.emf.internal.cdo.transaction;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.internal.cdo.util;version="4.5.0";
+ org.eclipse.emf.internal.cdo.util;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui",
- org.eclipse.emf.internal.cdo.view;version="4.5.0";
+ org.eclipse.emf.internal.cdo.view;version="4.6.0";
x-friends:="org.eclipse.emf.cdo.net4j,
org.eclipse.emf.cdo.server,
org.eclipse.emf.cdo.tests,
@@ -88,5 +88,5 @@ Export-Package: org.eclipse.emf.cdo;version="4.5.0",
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.spi.cdo;version="4.5.0"
+ org.eclipse.emf.spi.cdo;version="4.6.0"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo/plugin.xml b/plugins/org.eclipse.emf.cdo/plugin.xml
index 454a816c61..c8289c24b8 100644
--- a/plugins/org.eclipse.emf.cdo/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo/plugin.xml
@@ -59,19 +59,19 @@
id="org.eclipse.emf.cdo.view.properties"
type="org.eclipse.emf.cdo.view.CDOView"
namespace="org.eclipse.emf.cdo.view"
- properties="open,viewID,branchName,branch,timeStamp,lastUpdateTime,readOnly,dirty,durable,sessionID,userID,userAuthenticated,historical"
+ properties="open,viewID,branchName,branch,timeStamp,lastUpdateTime,rootResourcePermission,readOnly,dirty,durable,sessionID,userID,userAuthenticated,historical,autoReleaseLocks"
class="org.eclipse.emf.internal.cdo.view.ViewProperties$Tester"/>
<propertyTester
id="org.eclipse.emf.cdo.object.properties"
type="org.eclipse.emf.ecore.EObject"
namespace="org.eclipse.emf.cdo.object"
- properties="isCDO,id,version,branch,state,transactional,readable,writable,writableContainer,container,children,permission,permissionContainer,readLocks,readLocked,readLockedByOthers,writeLock,writeLocked,writeLockedByOthers,writeOption,writeOptioned,writeOptionedByOthers,viewHistorical,uri"
+ properties="isCDO,id,version,branch,state,transactional,readable,writable,writableContainer,container,children,permission,permissionContainer,readLocks,readLocked,readLockedByOthers,writeLock,writeLocked,writeLockedByOthers,writeOption,writeOptioned,writeOptionedByOthers,autoReleaseLocksExemption,viewHistorical,uri"
class="org.eclipse.emf.internal.cdo.object.ObjectProperties$Tester"/>
<propertyTester
id="org.eclipse.emf.cdo.object.properties"
type="org.eclipse.emf.cdo.CDOElement"
namespace="org.eclipse.emf.cdo.object"
- properties="isCDO,id,version,branch,state,transactional,readable,writable,writableContainer,container,children,permission,permissionContainer,readLocks,readLocked,readLockedByOthers,writeLock,writeLocked,writeLockedByOthers,writeOption,writeOptioned,writeOptionedByOthers,viewHistorical,uri"
+ properties="isCDO,id,version,branch,state,transactional,readable,writable,writableContainer,container,children,permission,permissionContainer,readLocks,readLocked,readLockedByOthers,writeLock,writeLocked,writeLockedByOthers,writeOption,writeOptioned,writeOptionedByOthers,autoReleaseLocksExemption,viewHistorical,uri"
class="org.eclipse.emf.internal.cdo.object.ObjectProperties$ElementTester"/>
</extension>
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java
index 4905d74085..7bada9a363 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOCommitContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2012, 2014 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2009-2012, 2014 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -55,11 +55,6 @@ public interface CDOCommitContext
public CDOTransaction getTransaction();
/**
- * @since 4.1
- */
- public boolean isAutoReleaseLocks();
-
- /**
* @since 4.0
*/
public boolean isPartialCommit();
@@ -80,11 +75,6 @@ public interface CDOCommitContext
public List<CDOPackageUnit> getNewPackageUnits();
/**
- * @since 4.1
- */
- public Collection<CDOLockState> getLocksOnNewObjects();
-
- /**
* Returns a map of the new {@link CDOObject objects} that are to be committed with this commit context.
*/
public Map<CDOID, CDOObject> getNewObjects();
@@ -108,4 +98,21 @@ public interface CDOCommitContext
* @since 4.0
*/
public Collection<CDOLob<?>> getLobs();
+
+ /**
+ * @since 4.1
+ * @deprecated As of 4.5 no longer supported. See {@link #getIDsToUnlock()}.
+ */
+ @Deprecated
+ public boolean isAutoReleaseLocks();
+
+ /**
+ * @since 4.1
+ */
+ public Collection<CDOLockState> getLocksOnNewObjects();
+
+ /**
+ * @since 4.6
+ */
+ public Collection<CDOID> getIDsToUnlock();
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
index 95d4460e3a..2ed5ff400e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOTransaction.java
@@ -292,24 +292,93 @@ public interface CDOTransaction extends CDOView, CDOCommonTransaction, CDOUserTr
public void setStaleReferenceCleaner(CDOStaleReferenceCleaner staleReferenceCleaner);
/**
- * Returns true if locks in this view will be removes when {@link CDOTransaction#commit()} or
- * {@link CDOTransaction#rollback()} is called.
+ * Returns <code>true</code> if locks in this transaction will be released when {@link CDOTransaction#commit()} or
+ * {@link CDOTransaction#rollback()} are called, <code>false</code> otherwise.
* <p>
- * Default value is true.
+ * The default value is <code>true</code>.
+ *
+ * @see #getAutoReleaseLocksExemptions()
*/
public boolean isAutoReleaseLocksEnabled();
/**
- * Specifies whether locks in this view will be removed when {@link CDOTransaction#commit()} or
- * {@link CDOTransaction#rollback()} is called.
+ * Specifies whether locks in this transaction will be released when {@link CDOTransaction#commit()} or
+ * {@link CDOTransaction#rollback()} are called.
* <p>
- * If false all locks are kept.
+ * If set to <code>false</code> all locks will be kept when {@link CDOTransaction#commit()} or
+ * {@link CDOTransaction#rollback()} are called.
* <p>
- * Default value is true.
+ * The default value is <code>true</code>.
+ *
+ * @see #getAutoReleaseLocksExemptions()
*/
public void setAutoReleaseLocksEnabled(boolean on);
/**
+ * Returns the set of {@link EObject objects} that are to be treated as exemptions to the {@link #isAutoReleaseLocksEnabled()} option.
+ * <p>
+ * That means:
+ * <p>
+ * <ul>
+ * <li> If {@link #isAutoReleaseLocksEnabled()} returns <code>true</code>, the locks on the objects in this set are <b>not</b> released
+ * when {@link CDOTransaction#commit()} or {@link CDOTransaction#rollback()} are called.
+ * <li> If {@link #isAutoReleaseLocksEnabled()} returns <code>false</code>, the locks on the objects in this set <b>are</b> released nevertheless
+ * when {@link CDOTransaction#commit()} or {@link CDOTransaction#rollback()} are called.
+ * </ul>
+ * <p>
+ * The returned set is unmodifiable. To modify the set use the {@link #clearAutoReleaseLocksExemptions() clearAutoReleaseLocksExemptions()},
+ * {@link #addAutoReleaseLocksExemptions(boolean, EObject...) addAutoReleaseLocksExemption()},
+ * and {@link #removeAutoReleaseLocksExemptions(boolean, EObject...) removeAutoReleaseLocksExemption()} methods.
+ * <p>
+ * <b>Implementation note</b>: This set stores weak references to the contained objects.
+ *
+ * @see #clearAutoReleaseLocksExemptions()
+ * @see #addAutoReleaseLocksExemptions(boolean, EObject...)
+ * @see #removeAutoReleaseLocksExemptions(boolean, EObject...)
+ * @since 4.6
+ */
+ public Set<? extends EObject> getAutoReleaseLocksExemptions();
+
+ /**
+ * Returns <code>true</code> if the given object is treated as an exemption to the {@link #isAutoReleaseLocksEnabled()} option,
+ * <code>false</code> otherwise.
+ *
+ * @see #getAutoReleaseLocksExemptions()
+ * @since 4.6
+ */
+ public boolean isAutoReleaseLocksExemption(EObject object);
+
+ /**
+ * Clears the set of {@link EObject objects} that are to be treated as exemptions to the {@link #isAutoReleaseLocksEnabled()} option.
+ *
+ * @see #getAutoReleaseLocksExemptions()
+ * @see #addAutoReleaseLocksExemptions(boolean, EObject...)
+ * @see #removeAutoReleaseLocksExemptions(boolean, EObject...)
+ * @since 4.6
+ */
+ public void clearAutoReleaseLocksExemptions();
+
+ /**
+ * Adds the given {@link EObject object} to the set of objects that are to be treated as exemptions to the {@link #isAutoReleaseLocksEnabled()} option.
+ *
+ * @see #getAutoReleaseLocksExemptions()
+ * @see #clearAutoReleaseLocksExemptions()
+ * @see #removeAutoReleaseLocksExemptions(boolean, EObject...)
+ * @since 4.6
+ */
+ public void addAutoReleaseLocksExemptions(boolean recursive, EObject... objects);
+
+ /**
+ * Removes the given {@link EObject object} from the set of objects that are to be treated as exemptions to the {@link #isAutoReleaseLocksEnabled()} option.
+ *
+ * @see #getAutoReleaseLocksExemptions()
+ * @see #clearAutoReleaseLocksExemptions()
+ * @see #addAutoReleaseLocksExemptions(boolean, EObject...)
+ * @since 4.6
+ */
+ public void removeAutoReleaseLocksExemptions(boolean recursive, EObject... objects);
+
+ /**
* Returns the number of milliseconds to wait for the transaction update when {@link CDOTransaction#commit()} is called.
* <p>
* Default value is 10000.
@@ -367,7 +436,8 @@ public interface CDOTransaction extends CDOView, CDOCommonTransaction, CDOUserTr
/**
* An {@link IOptionsEvent options event} fired from transaction {@link CDOTransaction#options() options} when the
- * {@link Options#setAutoReleaseLocksEnabled(boolean) auto release locks} option has changed.
+ * {@link Options#setAutoReleaseLocksEnabled(boolean) auto release locks enabled} or
+ * {@link Options#getAutoReleaseLocksExemptions() auto release locks exemptions} options have changed.
*
* @author Eike Stepper
* @since 3.0
@@ -376,6 +446,31 @@ public interface CDOTransaction extends CDOView, CDOCommonTransaction, CDOUserTr
*/
public interface AutoReleaseLocksEvent extends IOptionsEvent
{
+ /**
+ * An {@link AutoReleaseLocksEvent auto release locks options event} fired from transaction {@link CDOTransaction#options() options} when the
+ * {@link Options#setAutoReleaseLocksEnabled(boolean) auto release locks enabled} option has changed.
+ *
+ * @author Eike Stepper
+ * @since 4.6
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+ public interface AutoReleaseLocksEnabledEvent extends AutoReleaseLocksEvent
+ {
+ }
+
+ /**
+ * An {@link AutoReleaseLocksEvent auto release locks options event} fired from transaction {@link CDOTransaction#options() options} when the
+ * {@link Options#getAutoReleaseLocksExemptions() auto release locks exemptions} option has changed.
+ *
+ * @author Eike Stepper
+ * @since 4.6
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+ public interface AutoReleaseLocksExemptionsEvent extends AutoReleaseLocksEvent
+ {
+ }
}
/**
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
index 41cd6b114b..c6ec39bd64 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/util/CDOUtil.java
@@ -88,8 +88,10 @@ import org.eclipse.emf.spi.cdo.FSMUtil;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDOView;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
@@ -592,6 +594,20 @@ public final class CDOUtil
}
/**
+ * @since 4.6
+ */
+ public static List<? extends CDOObject> getCDOObjects(EObject... objects)
+ {
+ List<CDOObject> result = new ArrayList<CDOObject>();
+ for (EObject object : objects)
+ {
+ result.add(getCDOObject(object));
+ }
+
+ return result;
+ }
+
+ /**
* @since 4.4
*/
public static boolean isCDOObject(EObject object)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index 2a6dc0f379..ff9c2cf322 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -1635,7 +1635,7 @@ public class CDOObjectImpl extends MinimalEStoreEObjectImpl implements InternalC
* @author Eike Stepper
* @since 4.1
*/
- private final class CDOStoreEcoreEMap extends EcoreEMap<Object, Object>implements InternalCDOLoadable
+ private final class CDOStoreEcoreEMap extends EcoreEMap<Object, Object> implements InternalCDOLoadable
{
private static final long serialVersionUID = 1L;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/ObjectProperties.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/ObjectProperties.java
index 9f726b234e..2cd24d3c3c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/ObjectProperties.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/ObjectProperties.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.lock.CDOLockState;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.security.CDOPermission;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
@@ -519,6 +520,28 @@ public class ObjectProperties extends Properties<EObject>
}
});
+ add(new Property<EObject>("autoReleaseLocksExemption")//$NON-NLS-1$
+ {
+ @Override
+ protected Object eval(EObject object)
+ {
+ CDOObject cdoObject = getCDOObject(object);
+ if (cdoObject == null)
+ {
+ return false;
+ }
+
+ CDOView view = cdoObject.cdoView();
+ if (view instanceof CDOTransaction)
+ {
+ CDOTransaction transaction = (CDOTransaction)view;
+ return transaction.options().isAutoReleaseLocksExemption(cdoObject);
+ }
+
+ return false;
+ }
+ });
+
add(new Property<EObject>("viewHistorical") //$NON-NLS-1$
{
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index c80de5cabe..8c475d932f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -96,6 +96,8 @@ import org.eclipse.emf.cdo.transaction.CDOMerger;
import org.eclipse.emf.cdo.transaction.CDOSavepoint;
import org.eclipse.emf.cdo.transaction.CDOStaleReferenceCleaner;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.transaction.CDOTransaction.Options.AutoReleaseLocksEvent.AutoReleaseLocksEnabledEvent;
+import org.eclipse.emf.cdo.transaction.CDOTransaction.Options.AutoReleaseLocksEvent.AutoReleaseLocksExemptionsEvent;
import org.eclipse.emf.cdo.transaction.CDOTransactionConflictEvent;
import org.eclipse.emf.cdo.transaction.CDOTransactionFinishedEvent;
import org.eclipse.emf.cdo.transaction.CDOTransactionHandler;
@@ -146,6 +148,7 @@ import org.eclipse.net4j.util.transaction.TransactionException;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
@@ -176,7 +179,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -187,6 +189,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.WeakHashMap;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
@@ -3640,8 +3643,6 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
private CDOCommitData commitData;
- private Collection<CDOLockState> locksOnNewObjects;
-
private Map<CDOID, CDOObject> newObjects;
private Map<CDOID, CDOObject> detachedObjects;
@@ -3652,6 +3653,10 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
private Map<ByteArrayWrapper, CDOLob<?>> lobs = new HashMap<ByteArrayWrapper, CDOLob<?>>();
+ private List<CDOLockState> locksOnNewObjects = new ArrayList<CDOLockState>();
+
+ private List<CDOID> idsToUnlock = new ArrayList<CDOID>();
+
public CDOCommitContextImpl(InternalCDOTransaction transaction)
{
this.transaction = transaction;
@@ -3660,6 +3665,8 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
private void calculateCommitData()
{
+ OptionsImpl options = (OptionsImpl)transaction.options();
+
List<CDOPackageUnit> newPackageUnits = analyzeNewPackages();
newObjects = filterCommittables(transaction.getNewObjects());
@@ -3667,6 +3674,15 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
for (CDOObject newObject : newObjects.values())
{
revisions.add(newObject.cdoRevision());
+
+ CDOLockState lockState = getLockState(newObject);
+ if (lockState != null)
+ {
+ if (!options.isEffectiveAutoReleaseLock(newObject))
+ {
+ locksOnNewObjects.add(lockState);
+ }
+ }
}
revisionDeltas = filterCommittables(transaction.getRevisionDeltas());
@@ -3700,8 +3716,16 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
dirtyObjects = filterCommittables(transaction.getDirtyObjects());
- CDOLockState[] locksOnNewObjectsArray = getLockStates(newObjects.keySet(), false);
- locksOnNewObjects = Arrays.asList(locksOnNewObjectsArray);
+ for (CDOObject lockedObject : getLockStates().keySet())
+ {
+ if (!FSMUtil.isTransient(lockedObject))
+ {
+ if (options.isEffectiveAutoReleaseLock(lockedObject))
+ {
+ idsToUnlock.add(lockedObject.cdoID());
+ }
+ }
+ }
commitData = CDOCommitInfoUtil.createCommitData(newPackageUnits, revisions, deltas, detached);
}
@@ -3757,11 +3781,6 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return isPartialCommit;
}
- public boolean isAutoReleaseLocks()
- {
- return transaction.options().isAutoReleaseLocksEnabled();
- }
-
public String getCommitComment()
{
return transaction.getCommitComment();
@@ -3787,11 +3806,6 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return commitData.getNewPackageUnits();
}
- public Collection<CDOLockState> getLocksOnNewObjects()
- {
- return locksOnNewObjects;
- }
-
public Map<CDOID, CDOObject> getDetachedObjects()
{
return detachedObjects;
@@ -3807,6 +3821,22 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
return lobs.values();
}
+ @Deprecated
+ public boolean isAutoReleaseLocks()
+ {
+ return transaction.options().isAutoReleaseLocksEnabled();
+ }
+
+ public Collection<CDOLockState> getLocksOnNewObjects()
+ {
+ return locksOnNewObjects;
+ }
+
+ public List<CDOID> getIDsToUnlock()
+ {
+ return idsToUnlock;
+ }
+
public void preCommit()
{
if (isDirty())
@@ -3991,10 +4021,26 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
fireEvent(new FinishedEvent(idMappings), listeners);
}
- CDOLockState[] newLockStates = result.getNewLockStates();
- if (newLockStates != null)
+ Map<CDOObject, CDOLockState> lockStates = getLockStates();
+ if (!lockStates.isEmpty())
{
- updateAndNotifyLockStates(CDOLockChangeInfo.Operation.UNLOCK, null, result.getTimeStamp(), newLockStates);
+ List<CDOLockState> objectsToUnlock = new ArrayList<CDOLockState>();
+
+ for (Map.Entry<CDOObject, CDOLockState> entry : lockStates.entrySet())
+ {
+ CDOObject object = entry.getKey();
+ if (options().isEffectiveAutoReleaseLock(object))
+ {
+ InternalCDOLockState lockState = (InternalCDOLockState)entry.getValue();
+ lockState.updateFrom(InternalCDOLockState.UNLOCKED);
+
+ objectsToUnlock.add(lockState);
+ }
+ }
+
+ CDOLockState[] newLockStates = objectsToUnlock.toArray(new CDOLockState[objectsToUnlock.size()]);
+ notifyOtherViewsAboutLockChanges(CDOLockChangeInfo.Operation.UNLOCK, null, result.getTimeStamp(),
+ newLockStates);
}
}
catch (RuntimeException ex)
@@ -4175,12 +4221,14 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
{
private CDOUndoDetector undoDetector = DEFAULT_UNDO_DETECTOR;
- private List<CDOConflictResolver> conflictResolvers = new ArrayList<CDOConflictResolver>();
+ private final List<CDOConflictResolver> conflictResolvers = new ArrayList<CDOConflictResolver>();
private CDOStaleReferenceCleaner staleReferenceCleaner = CDOStaleReferenceCleaner.DEFAULT;
private boolean autoReleaseLocksEnabled = true;
+ private final Map<EObject, Boolean> autoReleaseLocksExemptions = new WeakHashMap<EObject, Boolean>();
+
private long commitInfoTimeout = DEFAULT_COMMIT_INFO_TIMEOUT;
public OptionsImpl()
@@ -4414,7 +4462,67 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
if (autoReleaseLocksEnabled != on)
{
autoReleaseLocksEnabled = on;
- event = new AutoReleaseLocksEventImpl();
+ event = new AutoReleaseLocksEnabledEventImpl();
+ }
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+
+ fireEvent(event);
+ }
+
+ public Set<? extends EObject> getAutoReleaseLocksExemptions()
+ {
+ synchronized (getViewMonitor())
+ {
+ lockView();
+
+ try
+ {
+ return new HashSet<EObject>(autoReleaseLocksExemptions.keySet());
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+ }
+
+ public boolean isAutoReleaseLocksExemption(EObject object)
+ {
+ synchronized (getViewMonitor())
+ {
+ lockView();
+
+ try
+ {
+ return autoReleaseLocksExemptions.get(CDOUtil.getCDOObject(object)) == Boolean.TRUE;
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+ }
+
+ public void clearAutoReleaseLocksExemptions()
+ {
+ checkActive();
+
+ IEvent event = null;
+ synchronized (getViewMonitor())
+ {
+ lockView();
+
+ try
+ {
+ if (!autoReleaseLocksExemptions.isEmpty())
+ {
+ autoReleaseLocksExemptions.clear();
+ event = new AutoReleaseLocksExemptionsEventImpl();
}
}
finally
@@ -4426,6 +4534,97 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
fireEvent(event);
}
+ public void addAutoReleaseLocksExemptions(boolean recursive, EObject... objects)
+ {
+ checkActive();
+
+ IEvent event = null;
+ synchronized (getViewMonitor())
+ {
+ lockView();
+
+ try
+ {
+ for (EObject object : objects)
+ {
+ if (autoReleaseLocksExemptions.put(CDOUtil.getCDOObject(object), Boolean.TRUE) == null)
+ {
+ event = new AutoReleaseLocksExemptionsEventImpl();
+ }
+
+ if (recursive)
+ {
+ for (TreeIterator<EObject> it = object.eAllContents(); it.hasNext();)
+ {
+ EObject child = it.next();
+ if (autoReleaseLocksExemptions.put(CDOUtil.getCDOObject(child), Boolean.TRUE) == null && event == null)
+ {
+ event = new AutoReleaseLocksExemptionsEventImpl();
+ }
+ }
+ }
+ }
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+
+ fireEvent(event);
+ }
+
+ public void removeAutoReleaseLocksExemptions(boolean recursive, EObject... objects)
+ {
+ checkActive();
+
+ IEvent event = null;
+ synchronized (getViewMonitor())
+ {
+ lockView();
+
+ try
+ {
+ for (EObject object : objects)
+ {
+ if (autoReleaseLocksExemptions.remove(CDOUtil.getCDOObject(object)) != null)
+ {
+ event = new AutoReleaseLocksExemptionsEventImpl();
+ }
+
+ if (recursive)
+ {
+ for (TreeIterator<EObject> it = object.eAllContents(); it.hasNext();)
+ {
+ EObject child = it.next();
+ if (autoReleaseLocksExemptions.remove(CDOUtil.getCDOObject(child)) != null && event == null)
+ {
+ event = new AutoReleaseLocksExemptionsEventImpl();
+ }
+ }
+ }
+ }
+ }
+ finally
+ {
+ unlockView();
+ }
+ }
+
+ fireEvent(event);
+ }
+
+ public boolean isEffectiveAutoReleaseLock(CDOObject newObject)
+ {
+ boolean effectiveAutoReleaseLock = autoReleaseLocksEnabled;
+ if (autoReleaseLocksExemptions.containsKey(newObject))
+ {
+ effectiveAutoReleaseLock = !effectiveAutoReleaseLock;
+ }
+
+ return effectiveAutoReleaseLock;
+ }
+
public long getCommitInfoTimeout()
{
return commitInfoTimeout;
@@ -4499,11 +4698,25 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
/**
* @author Eike Stepper
*/
- private final class AutoReleaseLocksEventImpl extends OptionsEvent implements AutoReleaseLocksEvent
+ private final class AutoReleaseLocksEnabledEventImpl extends OptionsEvent implements AutoReleaseLocksEnabledEvent
+ {
+ private static final long serialVersionUID = 1L;
+
+ public AutoReleaseLocksEnabledEventImpl()
+ {
+ super(OptionsImpl.this);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class AutoReleaseLocksExemptionsEventImpl extends OptionsEvent
+ implements AutoReleaseLocksExemptionsEvent
{
private static final long serialVersionUID = 1L;
- public AutoReleaseLocksEventImpl()
+ public AutoReleaseLocksExemptionsEventImpl()
{
super(OptionsImpl.this);
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUndoDetectorImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUndoDetectorImpl.java
index eb1fe86189..3f29900393 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUndoDetectorImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOUndoDetectorImpl.java
@@ -94,7 +94,7 @@ public class CDOUndoDetectorImpl implements CDOUndoDetector
}
/**
- * @deprecated As of CDO 4.5 {@link #detectUndo(CDOTransaction, CDORevision, CDORevision, CDOFeatureDelta)} is called.
+ * @deprecated As of 4.5 {@link #detectUndo(CDOTransaction, CDORevision, CDORevision, CDOFeatureDelta)} is called.
*/
@Deprecated
protected boolean detectUndoContainer(InternalCDORevision cleanRevision, InternalCDORevision currentRevision)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
index e475279359..0f1dd2fba3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOXACommitContextImpl.java
@@ -119,11 +119,6 @@ public class CDOXACommitContextImpl implements InternalCDOXACommitContext
return delegateCommitContext.getTransaction();
}
- public boolean isAutoReleaseLocks()
- {
- return delegateCommitContext.isAutoReleaseLocks();
- }
-
public boolean isPartialCommit()
{
return delegateCommitContext.isPartialCommit();
@@ -159,11 +154,6 @@ public class CDOXACommitContextImpl implements InternalCDOXACommitContext
return delegateCommitContext.getNewPackageUnits();
}
- public Collection<CDOLockState> getLocksOnNewObjects()
- {
- return delegateCommitContext.getLocksOnNewObjects();
- }
-
public Map<CDOID, CDOObject> getDetachedObjects()
{
return delegateCommitContext.getDetachedObjects();
@@ -179,6 +169,22 @@ public class CDOXACommitContextImpl implements InternalCDOXACommitContext
return delegateCommitContext.getLobs();
}
+ @Deprecated
+ public boolean isAutoReleaseLocks()
+ {
+ return delegateCommitContext.isAutoReleaseLocks();
+ }
+
+ public Collection<CDOLockState> getLocksOnNewObjects()
+ {
+ return delegateCommitContext.getLocksOnNewObjects();
+ }
+
+ public Collection<CDOID> getIDsToUnlock()
+ {
+ return delegateCommitContext.getIDsToUnlock();
+ }
+
public Object call() throws Exception
{
state.handle(this, progressMonitor);
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 694efefc37..814dcf43a3 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
@@ -99,6 +99,7 @@ import org.eclipse.net4j.util.ref.ReferenceValueMap;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -121,6 +122,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -361,6 +363,16 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
{
CDOLockState lockState = createUpdatedLockStateForNewObject(object, lockType, true);
locksOnNewObjects.add(lockState);
+
+ if (recursive)
+ {
+ for (TreeIterator<EObject> it = object.eAllContents(); it.hasNext();)
+ {
+ CDOObject child = CDOUtil.getCDOObject(it.next());
+ lockState = createUpdatedLockStateForNewObject(child, lockType, true);
+ locksOnNewObjects.add(lockState);
+ }
+ }
}
else
{
@@ -429,8 +441,13 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
}
}
- CDOLockState[] locksOnNewObjectsArray = locksOnNewObjects.toArray(new CDOLockState[locksOnNewObjects.size()]);
- updateLockStates(locksOnNewObjectsArray);
+ int locksOnNewObjectsCount = locksOnNewObjects.size();
+ if (locksOnNewObjectsCount != 0)
+ {
+ CDOLockState[] locksOnNewObjectsArray = locksOnNewObjects.toArray(new CDOLockState[locksOnNewObjectsCount]);
+ // updateLockStates(locksOnNewObjectsArray);
+ updateAndNotifyLockStates(Operation.LOCK, lockType, getTimeStamp(), locksOnNewObjectsArray);
+ }
if (result != null)
{
@@ -509,7 +526,8 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
/**
* Notifies other views of lock changes performed in this view
*/
- private void notifyOtherViewsAboutLockChanges(Operation op, LockType type, long timestamp, CDOLockState[] lockStates)
+ protected void notifyOtherViewsAboutLockChanges(Operation op, LockType type, long timestamp,
+ CDOLockState[] lockStates)
{
if (lockStates.length > 0)
{
@@ -637,6 +655,16 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
{
CDOLockState lockState = createUpdatedLockStateForNewObject(object, lockType, false);
locksOnNewObjects.add(lockState);
+
+ if (recursive)
+ {
+ for (TreeIterator<EObject> it = object.eAllContents(); it.hasNext();)
+ {
+ CDOObject child = CDOUtil.getCDOObject(it.next());
+ lockState = createUpdatedLockStateForNewObject(child, lockType, false);
+ locksOnNewObjects.add(lockState);
+ }
+ }
}
else
{
@@ -984,83 +1012,69 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
try
{
- List<CDOID> missing = new LinkedList<CDOID>();
- List<CDOLockState> lockStates = new LinkedList<CDOLockState>();
- List<CDOLockState> locksOnNewObjects = new ArrayList<CDOLockState>(ids.size());
+ List<CDOLockState> result = new ArrayList<CDOLockState>();
+ List<CDOLockState> lockStatesToUpdate = new ArrayList<CDOLockState>();
+ Set<CDOID> missingIDs = new LinkedHashSet<CDOID>();
for (CDOID id : ids)
{
- CDOLockState lockState = null;
InternalCDOObject object = getObject(id, false);
if (object != null)
{
- lockState = this.lockStates.get(object);
- }
+ CDOLockState lockState = lockStates.get(object);
+ if (lockState != null)
+ {
+ result.add(lockState);
+ continue;
+ }
- if (lockState != null)
- {
- lockStates.add(lockState);
- }
- else if (loadOnDemand && object != null && FSMUtil.isNew(object))
- {
- Object lockedObject = getLockTarget(object); // CDOID or CDOIDAndBranch
- CDOLockState defaultLockState = CDOLockUtil.createLockState(lockedObject);
- locksOnNewObjects.add(defaultLockState);
- lockStates.add(defaultLockState);
- }
- else
- {
- missing.add(id);
+ if (loadOnDemand && FSMUtil.isNew(object))
+ {
+ Object lockTarget = getLockTarget(this, id);
+ CDOLockState newLockState = CDOLockUtil.createLockState(lockTarget);
+
+ result.add(newLockState);
+ lockStatesToUpdate.add(newLockState);
+ continue;
+ }
}
+
+ missingIDs.add(id);
}
- if (loadOnDemand && (missing.size() > 0 || ids.isEmpty()))
+ if (loadOnDemand && (!missingIDs.isEmpty() || ids.isEmpty()))
{
CDOSessionProtocol sessionProtocol = session.getSessionProtocol();
- CDOLockState[] loadedLockStates = sessionProtocol.getLockStates(viewID, missing, CDOLockState.DEPTH_NONE);
- List<CDOLockState> newLockStateForCache = new ArrayList<CDOLockState>(
- loadedLockStates.length + missing.size());
+ CDOLockState[] loadedLockStates = sessionProtocol.getLockStates(viewID, missingIDs, CDOLockState.DEPTH_NONE);
+
for (CDOLockState loadedLockState : loadedLockStates)
{
- lockStates.add(loadedLockState);
- newLockStateForCache.add(loadedLockState);
+ result.add(loadedLockState);
+ lockStatesToUpdate.add(loadedLockState);
- CDOID cdoID = CDOIDUtil.getCDOID(loadedLockState.getLockedObject());
- if (cdoID != null)
+ CDOID id = CDOIDUtil.getCDOID(loadedLockState.getLockedObject());
+ if (id != null)
{
- missing.remove(cdoID);
+ missingIDs.remove(id);
}
}
- for (CDOID missingLockStateForCDOID : missing)
+ for (CDOID missingID : missingIDs)
{
- Object target;
+ Object lockTarget = getLockTarget(this, missingID);
+ CDOLockState defaultLockState = CDOLockUtil.createLockState(lockTarget);
- InternalCDOObject object = getObject(missingLockStateForCDOID, false);
- if (object != null)
- {
- target = getLockTarget(object); // CDOID or CDOIDAndBranch
- }
- else
- {
- target = missingLockStateForCDOID;
- }
-
- CDOLockState defaultLockState = CDOLockUtil.createLockState(target);
- lockStates.add(defaultLockState);
- newLockStateForCache.add(defaultLockState);
- }
-
- if (options().isLockNotificationEnabled())
- {
- updateLockStates(newLockStateForCache.toArray(new CDOLockState[newLockStateForCache.size()]));
+ result.add(defaultLockState);
+ lockStatesToUpdate.add(defaultLockState);
}
}
- CDOLockState[] locksOnNewObjectsArray = locksOnNewObjects.toArray(new CDOLockState[locksOnNewObjects.size()]);
- updateLockStates(locksOnNewObjectsArray);
+ if (!lockStatesToUpdate.isEmpty())
+ {
+ updateLockStates(lockStatesToUpdate.toArray(new CDOLockState[lockStatesToUpdate.size()]));
+ }
- return lockStates.toArray(new CDOLockState[lockStates.size()]);
+ return result.toArray(new CDOLockState[result.size()]);
}
finally
{
@@ -1079,6 +1093,11 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
return lockStates.get(object);
}
+ protected Map<CDOObject, CDOLockState> getLockStates()
+ {
+ return lockStates;
+ }
+
private CDOBranchPoint getBranchPointForID(CDOID id)
{
// If this view's timestamp is something other than UNSPECIFIED_DATE,
@@ -1822,8 +1841,12 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
}
CDOID id = object.cdoID();
- boolean branching = view.getSession().getRepositoryInfo().isSupportingBranches();
- if (branching)
+ return getLockTarget(view, id);
+ }
+
+ protected static Object getLockTarget(CDOView view, CDOID id)
+ {
+ if (view.getSession().getRepositoryInfo().isSupportingBranches())
{
return CDOIDUtil.createIDAndBranch(id, view.getBranch());
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/ViewProperties.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/ViewProperties.java
index 70d0dc1fba..738e562ee5 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/ViewProperties.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/ViewProperties.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.internal.cdo.view;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.StringUtil;
@@ -57,13 +58,13 @@ public class ViewProperties extends Properties<CDOView>
});
add(new Property<CDOView>("branchName") //$NON-NLS-1$
- {
+ {
@Override
protected Object eval(CDOView view)
{
return view.getBranch().getName();
}
- });
+ });
add(new Property<CDOView>("branch", //$NON-NLS-1$
"Branch", "The branch of this view.", CATEGORY_VIEW)
@@ -166,13 +167,27 @@ public class ViewProperties extends Properties<CDOView>
});
add(new Property<CDOView>("historical") //$NON-NLS-1$
- {
+ {
@Override
protected Object eval(CDOView view)
{
return view.getTimeStamp() != CDOBranchPoint.UNSPECIFIED_DATE;
}
- });
+ });
+
+ add(new Property<CDOView>("autoReleaseLocks") //$NON-NLS-1$
+ {
+ @Override
+ protected Object eval(CDOView view)
+ {
+ if (view instanceof CDOTransaction)
+ {
+ return ((CDOTransaction)view).options().isAutoReleaseLocksEnabled();
+ }
+
+ return false;
+ }
+ });
}
public static void main(String[] args)
diff --git a/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.util/META-INF/MANIFEST.MF
index a1071bf9f4..55a3c2dfb9 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.6.0.qualifier
+Bundle-Version: 3.7.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.6.0";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
- org.eclipse.net4j.internal.util.container;version="3.6.0";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.factory;version="3.6.0";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.om;version="3.6.0";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.om.pref;version="3.6.0";x-friends:="org.eclipse.net4j.util.defs",
- org.eclipse.net4j.internal.util.table;version="3.6.0";x-internal:=true,
- org.eclipse.net4j.internal.util.test;version="3.6.0";x-friends:="org.eclipse.net4j.tests",
- org.eclipse.net4j.util;version="3.6.0",
- org.eclipse.net4j.util.cache;version="3.6.0",
- org.eclipse.net4j.util.collection;version="3.6.0",
- org.eclipse.net4j.util.concurrent;version="3.6.0",
- org.eclipse.net4j.util.confirmation;version="3.6.0",
- org.eclipse.net4j.util.container;version="3.6.0",
- org.eclipse.net4j.util.container.delegate;version="3.6.0",
- org.eclipse.net4j.util.event;version="3.6.0",
- org.eclipse.net4j.util.factory;version="3.6.0",
- org.eclipse.net4j.util.fsm;version="3.6.0",
- org.eclipse.net4j.util.io;version="3.6.0",
- org.eclipse.net4j.util.lifecycle;version="3.6.0",
- org.eclipse.net4j.util.om;version="3.6.0",
- org.eclipse.net4j.util.om.log;version="3.6.0",
- org.eclipse.net4j.util.om.monitor;version="3.6.0",
- org.eclipse.net4j.util.om.pref;version="3.6.0",
- org.eclipse.net4j.util.om.trace;version="3.6.0",
- org.eclipse.net4j.util.options;version="3.6.0",
- org.eclipse.net4j.util.properties;version="3.6.0",
- org.eclipse.net4j.util.ref;version="3.6.0",
- org.eclipse.net4j.util.registry;version="3.6.0",
- org.eclipse.net4j.util.security;version="3.6.0",
- org.eclipse.net4j.util.transaction;version="3.6.0"
+Export-Package: org.eclipse.net4j.internal.util.bundle;version="3.7.0";x-friends:="org.eclipse.net4j.util.ui,org.eclipse.net4j.tests",
+ org.eclipse.net4j.internal.util.container;version="3.7.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.factory;version="3.7.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.om;version="3.7.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.om.pref;version="3.7.0";x-friends:="org.eclipse.net4j.util.defs",
+ org.eclipse.net4j.internal.util.table;version="3.7.0";x-internal:=true,
+ org.eclipse.net4j.internal.util.test;version="3.7.0";x-friends:="org.eclipse.net4j.tests",
+ org.eclipse.net4j.util;version="3.7.0",
+ org.eclipse.net4j.util.cache;version="3.7.0",
+ org.eclipse.net4j.util.collection;version="3.7.0",
+ org.eclipse.net4j.util.concurrent;version="3.7.0",
+ org.eclipse.net4j.util.confirmation;version="3.7.0",
+ org.eclipse.net4j.util.container;version="3.7.0",
+ org.eclipse.net4j.util.container.delegate;version="3.7.0",
+ org.eclipse.net4j.util.event;version="3.7.0",
+ org.eclipse.net4j.util.factory;version="3.7.0",
+ org.eclipse.net4j.util.fsm;version="3.7.0",
+ org.eclipse.net4j.util.io;version="3.7.0",
+ org.eclipse.net4j.util.lifecycle;version="3.7.0",
+ org.eclipse.net4j.util.om;version="3.7.0",
+ org.eclipse.net4j.util.om.log;version="3.7.0",
+ org.eclipse.net4j.util.om.monitor;version="3.7.0",
+ org.eclipse.net4j.util.om.pref;version="3.7.0",
+ org.eclipse.net4j.util.om.trace;version="3.7.0",
+ org.eclipse.net4j.util.options;version="3.7.0",
+ org.eclipse.net4j.util.properties;version="3.7.0",
+ org.eclipse.net4j.util.ref;version="3.7.0",
+ org.eclipse.net4j.util.registry;version="3.7.0",
+ org.eclipse.net4j.util.security;version="3.7.0",
+ org.eclipse.net4j.util.transaction;version="3.7.0"
Eclipse-BuddyPolicy: registered
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java
index 6a3ff3a6a3..7e9e087bb2 100644
--- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java
+++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java
@@ -57,6 +57,20 @@ public final class HashBag<T> implements Set<T>
return counter.getValue();
}
+ /**
+ * @since 3.7
+ */
+ public int removeCounterFor(T o)
+ {
+ Counter counter = map.remove(o);
+ if (counter == null)
+ {
+ return 0;
+ }
+
+ return counter.getValue();
+ }
+
public boolean add(T o)
{
return add(o, 1);
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 437445d636..565ba7925d 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
@@ -40,6 +40,8 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_CONCURRENCY, RWOLockManager.class);
+ private static final ThreadLocal<Boolean> UNLOCK_ALL = new ThreadLocal<Boolean>();
+
private final List<LockState<OBJECT, CONTEXT>> EMPTY_RESULT = Collections.emptyList();
private final Map<OBJECT, LockState<OBJECT, CONTEXT>> objectToLockStateMap = createObjectToLocksMap();
@@ -106,7 +108,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
lock(type, context, Collections.singleton(objectToLock), timeout);
}
- public synchronized void unlock(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock)
+ public void unlock(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock)
{
unlock2(type, context, objectsToUnlock);
}
@@ -114,57 +116,18 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
public synchronized List<LockState<OBJECT, CONTEXT>> unlock2(CONTEXT context,
Collection<? extends OBJECT> objectsToUnlock)
{
- if (objectsToUnlock.isEmpty())
- {
- return EMPTY_RESULT;
- }
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Unlock : {0} --> {1}", objectsToUnlock, context); //$NON-NLS-1$
- }
-
- Set<LockState<OBJECT, CONTEXT>> lockStates = new HashSet<LockState<OBJECT, CONTEXT>>();
-
- Iterator<? extends OBJECT> it = objectsToUnlock.iterator();
- while (it.hasNext())
- {
- OBJECT o = it.next();
- LockState<OBJECT, CONTEXT> lockState = objectToLockStateMap.get(o);
-
- if (lockState == null)
- {
- continue;
- }
-
- for (LockType lockType : LockType.values())
- {
- while (lockState.canUnlock(lockType, context))
- {
- lockState.unlock(lockType, context);
- lockStates.add(lockState);
- }
- }
- }
-
- for (LockState<OBJECT, CONTEXT> lockState : lockStates)
- {
- removeLockStateForContext(context, lockState);
-
- if (lockState.hasNoLocks())
- {
- objectToLockStateMap.remove(lockState.getLockedObject());
- }
- }
-
- notifyAll();
-
- return new LinkedList<RWOLockManager.LockState<OBJECT, CONTEXT>>(lockStates);
+ return unlock2(LockType.values(), context, objectsToUnlock);
}
public synchronized List<LockState<OBJECT, CONTEXT>> unlock2(LockType type, CONTEXT context,
Collection<? extends OBJECT> objectsToUnlock)
{
+ return unlock2(new LockType[] { type }, context, objectsToUnlock);
+ }
+
+ private List<LockState<OBJECT, CONTEXT>> unlock2(LockType[] types, CONTEXT context,
+ Collection<? extends OBJECT> objectsToUnlock)
+ {
if (objectsToUnlock.isEmpty())
{
return EMPTY_RESULT;
@@ -172,25 +135,34 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
if (TRACER.isEnabled())
{
- TRACER.format("Unlock", objectsToUnlock, context); //$NON-NLS-1$
+ TRACER.format("Unlock: {0} --> {1}", context, objectsToUnlock); //$NON-NLS-1$
}
- List<LockState<OBJECT, CONTEXT>> lockStates = new LinkedList<LockState<OBJECT, CONTEXT>>();
+ Set<LockState<OBJECT, CONTEXT>> result = new HashSet<LockState<OBJECT, CONTEXT>>();
- Iterator<? extends OBJECT> it = objectsToUnlock.iterator();
- while (it.hasNext())
+ for (OBJECT o : objectsToUnlock)
{
- OBJECT o = it.next();
LockState<OBJECT, CONTEXT> lockState = objectToLockStateMap.get(o);
- if (lockState != null && lockState.canUnlock(type, context))
+ if (lockState != null)
{
- lockStates.add(lockState);
+ for (LockType type : types)
+ {
+ while (lockState.canUnlock(type, context))
+ {
+ lockState.unlock(type, context);
+ result.add(lockState);
+
+ if (UNLOCK_ALL.get() != Boolean.TRUE)
+ {
+ break;
+ }
+ }
+ }
}
}
- for (LockState<OBJECT, CONTEXT> lockState : lockStates)
+ for (LockState<OBJECT, CONTEXT> lockState : result)
{
- lockState.unlock(type, context);
if (!lockState.hasLocks(context))
{
removeLockStateForContext(context, lockState);
@@ -204,7 +176,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
notifyAll();
- return lockStates;
+ return new LinkedList<RWOLockManager.LockState<OBJECT, CONTEXT>>(result);
}
public synchronized void unlock(CONTEXT context)
@@ -229,11 +201,11 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
for (LockState<OBJECT, CONTEXT> lockState : lockStates)
{
- for (LockType lockType : LockType.values())
+ for (LockType type : LockType.values())
{
- while (lockState.hasLock(lockType, context, false))
+ while (lockState.hasLock(type, context, false))
{
- lockState.unlock(lockType, context);
+ lockState.unlock(type, context);
}
}
@@ -442,6 +414,22 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
wait(waitTime);
}
+
+ }
+
+ /**
+ * @since 3.7
+ */
+ public static void setUnlockAll(boolean on)
+ {
+ if (on)
+ {
+ UNLOCK_ALL.set(Boolean.TRUE);
+ }
+ else
+ {
+ UNLOCK_ALL.remove();
+ }
}
/**
@@ -482,8 +470,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
return lockedObject;
}
- public boolean hasLock(org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type, CONTEXT view,
- boolean byOthers)
+ public boolean hasLock(LockType type, CONTEXT view, boolean byOthers)
{
CheckUtil.checkArg(view, "view");
@@ -517,7 +504,7 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
return false;
}
- public boolean hasLock(org.eclipse.net4j.util.concurrent.IRWLockManager.LockType type)
+ public boolean hasLock(LockType type)
{
switch (type)
{
@@ -534,6 +521,49 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
return false;
}
+ public Set<CONTEXT> getReadLockOwners()
+ {
+ return Collections.unmodifiableSet(readLockOwners);
+ }
+
+ public CONTEXT getWriteLockOwner()
+ {
+ return writeLockOwner;
+ }
+
+ public CONTEXT getWriteOptionOwner()
+ {
+ return writeOptionOwner;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return lockedObject.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (!(obj instanceof LockState))
+ {
+ return false;
+ }
+
+ LockState<?, ?> other = (LockState<?, ?>)obj;
+ return lockedObject.equals(other.lockedObject);
+ }
+
@Override
public String toString()
{
@@ -808,20 +838,5 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo
{
writeOptionOwner = null;
}
-
- public Set<CONTEXT> getReadLockOwners()
- {
- return Collections.unmodifiableSet(readLockOwners);
- }
-
- public CONTEXT getWriteLockOwner()
- {
- return writeLockOwner;
- }
-
- public CONTEXT getWriteOptionOwner()
- {
- return writeOptionOwner;
- }
}
}
diff --git a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
index 67e3c0df64..4f83a32180 100644
--- a/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j;singleton:=true
-Bundle-Version: 4.5.0.qualifier
+Bundle-Version: 4.6.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -11,7 +11,7 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)";resolution:=optional,
org.eclipse.net4j.util;bundle-version="[3.0.0,4.0.0)";visibility:=reexport
-Export-Package: org.eclipse.internal.net4j;version="4.5.0";
+Export-Package: org.eclipse.internal.net4j;version="4.6.0";
x-friends:="org.eclipse.net4j.http.server,
org.eclipse.net4j.jvm,
org.eclipse.net4j.tcp,
@@ -20,7 +20,7 @@ Export-Package: org.eclipse.internal.net4j;version="4.5.0";
org.eclipse.net4j.http.tests,
org.eclipse.net4j.tests,
org.eclipse.net4j.defs",
- org.eclipse.internal.net4j.buffer;version="4.5.0";
+ org.eclipse.internal.net4j.buffer;version="4.6.0";
x-friends:="org.eclipse.net4j.http.server,
org.eclipse.net4j.jvm,
org.eclipse.net4j.tcp,
@@ -29,17 +29,17 @@ Export-Package: org.eclipse.internal.net4j;version="4.5.0";
org.eclipse.net4j.http.tests,
org.eclipse.net4j.tests,
org.eclipse.net4j.defs",
- org.eclipse.internal.net4j.bundle;version="4.5.0";x-internal:=true,
- org.eclipse.net4j;version="4.5.0",
- org.eclipse.net4j.acceptor;version="4.5.0",
- org.eclipse.net4j.buffer;version="4.5.0",
- org.eclipse.net4j.channel;version="4.5.0",
- org.eclipse.net4j.connector;version="4.5.0",
- org.eclipse.net4j.protocol;version="4.5.0",
- org.eclipse.net4j.signal;version="4.5.0",
- org.eclipse.net4j.signal.confirmation;version="4.5.0",
- org.eclipse.net4j.signal.heartbeat;version="4.5.0",
- org.eclipse.net4j.signal.security;version="4.5.0",
- org.eclipse.net4j.signal.wrapping;version="4.5.0",
- org.eclipse.spi.net4j;version="4.5.0"
+ org.eclipse.internal.net4j.bundle;version="4.6.0";x-internal:=true,
+ org.eclipse.net4j;version="4.6.0",
+ org.eclipse.net4j.acceptor;version="4.6.0",
+ org.eclipse.net4j.buffer;version="4.6.0",
+ org.eclipse.net4j.channel;version="4.6.0",
+ org.eclipse.net4j.connector;version="4.6.0",
+ org.eclipse.net4j.protocol;version="4.6.0",
+ org.eclipse.net4j.signal;version="4.6.0",
+ org.eclipse.net4j.signal.confirmation;version="4.6.0",
+ org.eclipse.net4j.signal.heartbeat;version="4.6.0",
+ org.eclipse.net4j.signal.security;version="4.6.0",
+ org.eclipse.net4j.signal.wrapping;version="4.6.0",
+ org.eclipse.spi.net4j;version="4.6.0"
Eclipse-BuddyPolicy: registered
diff --git a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalCounter.java b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalCounter.java
index 7a5f654216..be525cbf09 100644
--- a/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalCounter.java
+++ b/plugins/org.eclipse.net4j/src/org/eclipse/net4j/signal/SignalCounter.java
@@ -25,8 +25,11 @@ public final class SignalCounter implements IListener
{
private HashBag<Class<? extends Signal>> signals = new HashBag<Class<? extends Signal>>();
+ private final ISignalProtocol<?> protocol;
+
public SignalCounter()
{
+ protocol = null;
}
/**
@@ -34,14 +37,11 @@ public final class SignalCounter implements IListener
*/
public SignalCounter(ISignalProtocol<?> protocol)
{
- protocol.addListener(this);
- }
+ this.protocol = protocol;
- public int getCountFor(Class<? extends Signal> signal)
- {
- synchronized (signals)
+ if (protocol != null)
{
- return signals.getCounterFor(signal);
+ protocol.addListener(this);
}
}
@@ -58,6 +58,25 @@ public final class SignalCounter implements IListener
}
}
+ public int getCountFor(Class<? extends Signal> signal)
+ {
+ synchronized (signals)
+ {
+ return signals.getCounterFor(signal);
+ }
+ }
+
+ /**
+ * @since 4.6
+ */
+ public int removeCountFor(Class<? extends Signal> signal)
+ {
+ synchronized (signals)
+ {
+ return signals.removeCounterFor(signal);
+ }
+ }
+
public void clearCounts()
{
synchronized (signals)
@@ -77,4 +96,15 @@ public final class SignalCounter implements IListener
}
}
}
+
+ /**
+ * @since 4.6
+ */
+ public void dispose()
+ {
+ if (protocol != null)
+ {
+ protocol.removeListener(this);
+ }
+ }
}

Back to the top