Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-02-21 08:24:03 +0000
committerEike Stepper2020-02-21 08:24:03 +0000
commit7d10d7c9d86eb2cad9ed5ac6df60bcb7a5f71b39 (patch)
tree80c928fcb72e6707ea87215d1d2f4f963837e617
parent4c5cc26ab9266fcd3b0fcbb3d620b162f5234b1d (diff)
downloadcdo-7d10d7c9d86eb2cad9ed5ac6df60bcb7a5f71b39.tar.gz
cdo-7d10d7c9d86eb2cad9ed5ac6df60bcb7a5f71b39.tar.xz
cdo-7d10d7c9d86eb2cad9ed5ac6df60bcb7a5f71b39.zip
[560280] Possible deadlock during the session invalidation
https://bugs.eclipse.org/bugs/show_bug.cgi?id=560280
-rw-r--r--plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_560280_Test.java107
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java83
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java25
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java10
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java21
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java2
11 files changed, 189 insertions, 110 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java
index 656606c810..88b1864a3c 100644
--- a/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common.db/src/org/eclipse/emf/cdo/common/internal/db/cache/DBRevisionCache.java
@@ -57,6 +57,7 @@ import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.function.Consumer;
/**
* A JDBC-based {@link CDORevisionCache}.
@@ -422,9 +423,14 @@ public class DBRevisionCache extends Lifecycle implements InternalCDORevisionCac
}
@Override
+ public void forEachCurrentRevision(Consumer<CDORevision> consumer)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public void getAllRevisions(List<InternalCDORevision> result)
{
- // TODO: implement DBRevisionCache.enclosing_method(enclosing_method_arguments)
throw new UnsupportedOperationException();
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
index 6635d4ae39..6d0cf8f1ae 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionCache.java
@@ -21,6 +21,7 @@ import org.eclipse.net4j.util.event.INotifier;
import org.eclipse.emf.ecore.EClass;
import java.util.List;
+import java.util.function.Consumer;
/**
* Caches {@link CDORevision revisions} and possibly {@link EvictionEvent evicts} those that are no longer strongly
@@ -58,6 +59,13 @@ public interface CDORevisionCache extends CDORevisionCacheAdder, INotifier
public List<CDORevision> getCurrentRevisions();
/**
+ * Passes each {@link CDORevision revision} that is current into the given consumer.
+ *
+ * @since 4.9
+ */
+ public void forEachCurrentRevision(Consumer<CDORevision> consumer);
+
+ /**
* An {@link IEvent event} fired from a {@link CDORevisionCache revision cache} for {@link CDORevision revisions} that
* are evicted because they are no longer strongly referenced when free memory runs low.
*
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
index f8510b489a..0a6ffc410e 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheAuditing.java
@@ -35,6 +35,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
+import java.util.function.Consumer;
/**
* @author Eike Stepper
@@ -108,6 +109,13 @@ public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
public List<CDORevision> getCurrentRevisions()
{
List<CDORevision> currentRevisions = new ArrayList<>();
+ forEachCurrentRevision(r -> currentRevisions.add(r));
+ return currentRevisions;
+ }
+
+ @Override
+ public void forEachCurrentRevision(Consumer<CDORevision> consumer)
+ {
synchronized (revisionLists)
{
for (RevisionList revisionList : revisionLists.values())
@@ -115,12 +123,10 @@ public class CDORevisionCacheAuditing extends AbstractCDORevisionCache
InternalCDORevision revision = revisionList.getRevision(CDORevision.UNSPECIFIED_DATE);
if (revision != null)
{
- currentRevisions.add(revision);
+ consumer.accept(revision);
}
}
}
-
- return currentRevisions;
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
index 1e817ebb5c..89935ec366 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionCacheNonAuditing.java
@@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Consumer;
/**
* @author Eike Stepper
@@ -113,6 +114,13 @@ public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
public List<CDORevision> getCurrentRevisions()
{
List<CDORevision> currentRevisions = new ArrayList<>();
+ forEachCurrentRevision(r -> currentRevisions.add(r));
+ return currentRevisions;
+ }
+
+ @Override
+ public void forEachCurrentRevision(Consumer<CDORevision> consumer)
+ {
synchronized (revisions)
{
for (Reference<InternalCDORevision> ref : revisions.values())
@@ -120,12 +128,10 @@ public class CDORevisionCacheNonAuditing extends AbstractCDORevisionCache
InternalCDORevision revision = ref.get();
if (revision != null && !revision.isHistorical())
{
- currentRevisions.add(revision);
+ consumer.accept(revision);
}
}
}
-
- return currentRevisions;
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
index 801496c2af..ae3fd7333b 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/NOOPRevisionCache.java
@@ -25,6 +25,7 @@ import org.eclipse.emf.ecore.EClass;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.function.Consumer;
/**
* @author Eike Stepper
@@ -33,7 +34,7 @@ public class NOOPRevisionCache extends Lifecycle implements InternalCDORevisionC
{
public static final NOOPRevisionCache INSTANCE = new NOOPRevisionCache();
- private static final List<CDORevision> EMPTY = Collections.emptyList();
+ private static final List<CDORevision> EMPTY_LIST = Collections.emptyList();
public NOOPRevisionCache()
{
@@ -59,7 +60,13 @@ public class NOOPRevisionCache extends Lifecycle implements InternalCDORevisionC
@Override
public List<CDORevision> getCurrentRevisions()
{
- return EMPTY;
+ return EMPTY_LIST;
+ }
+
+ @Override
+ public void forEachCurrentRevision(Consumer<CDORevision> consumer)
+ {
+ // Do nothing.
}
public InternalCDORevision getRevision(CDOID id)
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_560280_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_560280_Test.java
index 763276ae05..a9979ef1df 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_560280_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_560280_Test.java
@@ -10,20 +10,38 @@
*/
package org.eclipse.emf.cdo.tests.bugzilla;
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionConfigurationImpl;
import org.eclipse.emf.cdo.internal.net4j.CDONet4jSessionImpl;
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.security.Group;
+import org.eclipse.emf.cdo.security.Realm;
+import org.eclipse.emf.cdo.security.User;
+import org.eclipse.emf.cdo.server.security.ISecurityManager;
+import org.eclipse.emf.cdo.server.security.SecurityManagerUtil;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesAfter;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
+import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig;
import org.eclipse.emf.cdo.tests.config.impl.SessionConfig;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CommitException;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.security.IPasswordCredentials;
+import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
+import org.eclipse.net4j.util.security.PasswordCredentials;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.emf.spi.cdo.InternalCDOView;
+import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@@ -33,14 +51,44 @@ import java.util.concurrent.atomic.AtomicReference;
*
* @author Eike Stepper
*/
+@CleanRepositoriesBefore(reason = "Security manager installed on repository")
+@CleanRepositoriesAfter(reason = "Security manager installed on repository")
public class Bugzilla_560280_Test extends AbstractCDOTest
{
+ @Override
+ public void setUp() throws Exception
+ {
+ getTestProperties().put(SessionConfig.PROP_TEST_CREDENTIALS_PROVIDER, new IPasswordCredentialsProvider()
+ {
+
+ @Override
+ public boolean isInteractive()
+ {
+ return false;
+ }
+
+ @Override
+ public IPasswordCredentials getCredentials()
+ {
+ return new PasswordCredentials(User.ADMINISTRATOR, "0000");
+ }
+ });
+
+ super.doSetUp();
+
+ // Create the security manager and attach it to the repository
+ ISecurityManager securityManager = SecurityManagerUtil.createSecurityManager("/security", getServerContainer());
+ getTestProperties().put(RepositoryConfig.PROP_TEST_SECURITY_MANAGER, securityManager);
+ getRepository();
+ LifecycleUtil.waitForActive(securityManager, 10000L);
+ }
+
public void testDeadlockBetweenInvalidationAndCommit() throws Exception
{
CDOSession session1 = openSession();
CDOTransaction transaction1 = session1.openTransaction();
- CDOResource resource1 = transaction1.createResource(getResourcePath("resource1"));
- transaction1.commit();
+ Realm realm1 = getRealm(transaction1);
+ Group group1 = realm1.getGroup("Users");
AtomicReference<CDOTransaction> transactionUnderTest = new AtomicReference<>();
AtomicBoolean controlUpdatePermissions = new AtomicBoolean();
@@ -55,19 +103,15 @@ public class Bugzilla_560280_Test extends AbstractCDOTest
return new CDONet4jSessionImpl()
{
@Override
- public InternalCDOView[] getViews()
+ protected Map<CDORevision, CDOPermission> updatePermissions(CDOCommitInfo commitInfo, InternalCDOView[] views)
{
if (controlUpdatePermissions.get())
{
reachedUpdatePermissions.countDown();
await(allowUpdatePermissions);
-
- transactionUnderTest.get().syncExec(() -> {
- // Just take the view lock.
- });
}
- return super.getViews();
+ return super.updatePermissions(commitInfo, views);
}
};
}
@@ -83,7 +127,6 @@ public class Bugzilla_560280_Test extends AbstractCDOTest
CDOSession sessionUnderTest = openSession();
transactionUnderTest.set(sessionUnderTest.openTransaction());
- CDOResource resourceUnderTest = transactionUnderTest.get().createResource(getResourcePath("resourceUnderTest"));
/*
* Test Logic:
@@ -91,31 +134,45 @@ public class Bugzilla_560280_Test extends AbstractCDOTest
controlUpdatePermissions.set(true);
- resource1.getContents().add(getModel1Factory().createCompany());
+ group1.setId("ModernUsers");
transaction1.commit();
// Execute transactionUndertTest.commit() on a separate thread so that the deadlock doesn't freeze the test suite.
- new PollingTimeOuter()
+ CountDownLatch commitFinished = new CountDownLatch(1);
+ new Thread("CommitterUnderTest")
{
@Override
- protected boolean successful()
+ public void run()
{
await(reachedUpdatePermissions);
- allowUpdatePermissions.countDown();
- try
- {
- resourceUnderTest.getContents().add(getModel1Factory().createCompany());
- transactionUnderTest.get().commit();
- }
- catch (CommitException ex)
- {
- // This is really not expected now.
- ex.printStackTrace();
- }
+ CDOTransaction tx = transactionUnderTest.get();
+ tx.syncExec(() -> {
+ allowUpdatePermissions.countDown();
+
+ try
+ {
+ Realm realmUnderTest = getRealm(tx);
+ realmUnderTest.addUser("UserUnderTest", "abc");
- return true;
+ tx.commit();
+ commitFinished.countDown();
+ }
+ catch (CommitException ex)
+ {
+ // This is really not expected now.
+ ex.printStackTrace();
+ }
+ });
}
- }.assertNoTimeOut();
+ }.start();
+
+ await(commitFinished);
+ }
+
+ Realm getRealm(CDOView view)
+ {
+ CDOResource resource = view.getResource("/security");
+ return (Realm)resource.getContents().get(0);
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index 45874994cb..b3907605c4 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -16,7 +16,6 @@
*/
package org.eclipse.emf.internal.cdo.session;
-import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.CDOCommonRepository;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
@@ -113,6 +112,7 @@ import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.log.OMLogger;
import org.eclipse.net4j.util.om.trace.ContextTracer;
import org.eclipse.net4j.util.options.OptionsEvent;
@@ -129,7 +129,6 @@ import org.eclipse.emf.spi.cdo.CDOPermissionUpdater;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.MergeDataResult;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.RefreshSessionResult;
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDORemoteSessionManager;
import org.eclipse.emf.spi.cdo.InternalCDOSession;
import org.eclipse.emf.spi.cdo.InternalCDOSessionInvalidationEvent;
@@ -164,6 +163,8 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SESSION, CDOSessionImpl.class);
+ private static final boolean DEBUG_INVALIDATION = OMPlatform.INSTANCE.isProperty("org.eclipse.emf.internal.cdo.session.CDOSessionImpl.DEBUG_INVALIDATION");
+
private ExceptionHandler exceptionHandler;
private CDOIDGenerator idGenerator;
@@ -659,6 +660,19 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
return getBranchManager().getMainBranch();
}
+ protected Map<CDORevision, CDOPermission> updatePermissions(CDOCommitInfo commitInfo, InternalCDOView[] views)
+ {
+ CDOPermissionUpdater permissionUpdater = options().getPermissionUpdater();
+ if (permissionUpdater != null)
+ {
+ Set<InternalCDORevision> revisions = new HashSet<>();
+ revisionManager.getCache().forEachCurrentRevision(r -> revisions.add((InternalCDORevision)r));
+ return permissionUpdater.updatePermissions(CDOSessionImpl.this, revisions);
+ }
+
+ return null;
+ }
+
/**
* @since 2.0
*/
@@ -1944,8 +1958,6 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
*/
private final class SessionInvalidator extends SerializingExecutor
{
- private static final boolean DEBUG = false;
-
private final Set<Object> unfinishedLocalCommits = new HashSet<>();
private final List<SessionInvalidation> reorderQueue = new ArrayList<>();
@@ -1965,7 +1977,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
CommitToken token = new CommitToken(++lastCommitNumber, Thread.currentThread().getName());
- if (DEBUG)
+ if (DEBUG_INVALIDATION)
{
IOUtil.OUT().println(CDOSessionImpl.this + " [" + getLastUpdateTime() % 10000 + "] startLocalCommit: " + token);
}
@@ -1976,7 +1988,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
public synchronized void endLocalCommit(Object token)
{
- if (DEBUG)
+ if (DEBUG_INVALIDATION)
{
IOUtil.OUT().println(CDOSessionImpl.this + " [" + getLastUpdateTime() % 10000 + "] endLocalCommit: " + token);
}
@@ -1991,7 +2003,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
reorderQueue.add(invalidation);
Collections.sort(reorderQueue);
- if (DEBUG)
+ if (DEBUG_INVALIDATION)
{
IOUtil.OUT().println(CDOSessionImpl.this + " [" + getLastUpdateTime() % 10000 + "] " + invalidation.getPreviousTimeStamp() % 10000 + " --> "
+ invalidation.getTimeStamp() % 10000 + " reorderQueue=" + reorderQueue + " unfinishedLocalCommits=" + unfinishedLocalCommits);
@@ -2070,7 +2082,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
{
long timeStamp = getTimeStamp();
- if (SessionInvalidator.DEBUG)
+ if (DEBUG_INVALIDATION)
{
IOUtil.OUT().println(CDOSessionImpl.this + " [" + getLastUpdateTime() % 10000 + "] " + timeStamp % 10000 + " INVALIDATE");
}
@@ -2089,7 +2101,7 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
if (invalidationData.getSecurityImpact() != CommitNotificationInfo.IMPACT_NONE)
{
- oldPermissions = updatePermissions(views);
+ oldPermissions = updatePermissions(commitInfo, views);
}
commitInfoManager.setLastCommitOfBranch(branch, timeStamp);
@@ -2136,56 +2148,6 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
}
}
- private Map<CDORevision, CDOPermission> updatePermissions(InternalCDOView[] views)
- {
- CDOPermissionUpdater permissionUpdater = options().getPermissionUpdater();
- if (permissionUpdater != null)
- {
- CDOBranchPoint head = getBranchManager().getMainBranch().getHead();
- Set<InternalCDORevision> revisions = new HashSet<>();
-
- for (int i = 0; i < views.length; i++)
- {
- InternalCDOView view = views[i];
- if (!head.equals(view))
- {
- throw new IllegalStateException("Security not supported with auditing or branching");
- }
-
- for (InternalCDOObject object : view.getObjects().values())
- {
- InternalCDORevision revision;
-
- CDOState state = object.cdoState();
- switch (state)
- {
- case CLEAN:
- revision = object.cdoRevision();
- break;
-
- case DIRTY:
- case CONFLICT:
- CDOID id = object.cdoID();
- revision = getRevisionManager().getRevision(id, head, 0, CDORevision.DEPTH_NONE, false);
- break;
-
- default:
- continue;
- }
-
- if (revision != null && !commitInfo.getDetachedObjects().contains(CDOIDUtil.createIDAndVersion(revision)))
- {
- revisions.add(revision);
- }
- }
- }
-
- return permissionUpdater.updatePermissions(CDOSessionImpl.this, revisions);
- }
-
- return null;
- }
-
private Map<CDOID, InternalCDORevision> reviseRevisions()
{
Map<CDOID, InternalCDORevision> oldRevisions = null;
@@ -2285,8 +2247,11 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
{
try
{
+ byte securityImpact = invalidationData.getSecurityImpact();
+
ViewInvalidationData invalidationData = new ViewInvalidationData();
invalidationData.setLastUpdateTime(getTimeStamp());
+ invalidationData.setSecurityImpact(securityImpact);
invalidationData.setAsync(true);
// The committing view (sender) is already valid, just the timestamp must be set "in sequence".
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 3f45246014..2c67eb1db8 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
@@ -1648,31 +1648,24 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
private CDOCommitInfo commitSynced(IProgressMonitor progressMonitor) throws DanglingIntegrityException, CommitException
{
- try
- {
- checkActive();
- }
- catch (Exception ex)
- {
- throw new CommitException(ex);
- }
-
- InternalCDOSession session = getSession();
- commitToken = (CommitToken)session.startLocalCommit();
-
synchronized (getViewMonitor())
{
lockView();
try
{
- if (hasConflict())
- {
- throw new LocalCommitConflictException(Messages.getString("CDOTransactionImpl.2")); //$NON-NLS-1$
- }
+ InternalCDOSession session = getSession();
try
{
+ checkActive();
+ if (hasConflict())
+ {
+ throw new LocalCommitConflictException(Messages.getString("CDOTransactionImpl.2")); //$NON-NLS-1$
+ }
+
+ commitToken = (CommitToken)session.startLocalCommit();
+
CDOTransactionStrategy transactionStrategy = getTransactionStrategy();
CDOCommitInfo info = transactionStrategy.commit(this, progressMonitor);
if (info != null)
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 e9004c32a1..e17387e02f 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
@@ -25,6 +25,7 @@ import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo.Operation;
import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
import org.eclipse.emf.cdo.common.lock.CDOLockState;
import org.eclipse.emf.cdo.common.lock.CDOLockUtil;
+import org.eclipse.emf.cdo.common.protocol.CDOProtocol.CommitNotificationInfo;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants.UnitOpcode;
import org.eclipse.emf.cdo.common.revision.CDOIDAndBranch;
import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
@@ -1223,6 +1224,15 @@ public class CDOViewImpl extends AbstractCDOView implements IExecutorServiceProv
private void doInvalidateSynced(ViewInvalidationData invalidationData)
{
+ if (invalidationData.getSecurityImpact() != CommitNotificationInfo.IMPACT_NONE)
+ {
+ CDOBranchPoint head = session.getBranchManager().getMainBranch().getHead();
+ if (!head.equals(this))
+ {
+ throw new IllegalStateException("Security not supported with auditing or branching");
+ }
+ }
+
if (getTimeStamp() != UNSPECIFIED_DATE && CDOStateMachine.SWITCHING_TARGET.get() != Boolean.TRUE)
{
// Don't invalidate historical views unless during a branch point switch.
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
index c5c48aec98..650e60222f 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOView.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDProvider;
import org.eclipse.emf.cdo.common.lock.CDOLockChangeInfo;
+import org.eclipse.emf.cdo.common.protocol.CDOProtocol.CommitNotificationInfo;
import org.eclipse.emf.cdo.common.revision.CDOIDAndVersion;
import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
@@ -294,6 +295,8 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
private CDOLockChangeInfo lockChangeInfo;
+ private byte securityImpact = CommitNotificationInfo.IMPACT_NONE;
+
public ViewInvalidationData()
{
}
@@ -378,6 +381,22 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
this.lockChangeInfo = lockChangeInfo;
}
+ /**
+ * @since 4.9
+ */
+ public byte getSecurityImpact()
+ {
+ return securityImpact;
+ }
+
+ /**
+ * @since 4.9
+ */
+ public void setSecurityImpact(byte securityImpact)
+ {
+ this.securityImpact = securityImpact;
+ }
+
@Override
public String toString()
{
@@ -398,6 +417,8 @@ public interface InternalCDOView extends CDOView, CDOIDProvider, ILifecycle
builder.append(clearResourcePathCache);
builder.append(", lockChangeInfo=");
builder.append(lockChangeInfo);
+ builder.append(", securityImpact=");
+ builder.append(securityImpact);
builder.append("]");
return builder.toString();
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index b6eaa4c4e4..a9b6e41323 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -69,7 +69,7 @@ public abstract class AbstractOMTest extends TestCase
/**
* Timeout duration in millseconds if timeout <b>is not</b> expected.
*/
- public static final long DEFAULT_TIMEOUT = 15 * 1000;
+ public static final long DEFAULT_TIMEOUT = 15 * 1000 * 1000;
/**
* Timeout duration in millseconds if timeout <b>is</b> expected.

Back to the top