diff options
author | Ansgar Radermacher | 2017-03-22 08:25:58 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2017-03-22 12:12:10 +0000 |
commit | a9a981d0170fe18f93d77285dadac136f085eceb (patch) | |
tree | eb9f4e16d144e0876fe081b2a5be7aa70ddbd48b /plugins/infra | |
parent | caa6e5ba9b89ee1539d08ef5782d0da3038efc3c (diff) | |
download | org.eclipse.papyrus-a9a981d0170fe18f93d77285dadac136f085eceb.tar.gz org.eclipse.papyrus-a9a981d0170fe18f93d77285dadac136f085eceb.tar.xz org.eclipse.papyrus-a9a981d0170fe18f93d77285dadac136f085eceb.zip |
Bug 507024 - [Model management] Deletion of a model that is currently open blocks UI
- Wait with a 5 seconds timeout for a lock. This avoids deadlocks as described in this bug and in comment 3 of bug 512554
Change-Id: I1127c0901d92b78e48c2a6b31ce1d2e249bad262
Diffstat (limited to 'plugins/infra')
-rw-r--r-- | plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java index f755c220494..66fbcd84b39 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/internal/resource/AbstractCrossReferenceIndex.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2016 Christian W. Damus 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 @@ -8,7 +8,7 @@ * * Contributors: * Christian W. Damus - Initial API and implementation - * + * *****************************************************************************/ package org.eclipse.papyrus.infra.emf.internal.resource; @@ -20,6 +20,8 @@ import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -195,11 +197,14 @@ public abstract class AbstractCrossReferenceIndex implements ICrossReferenceInde final <V> V sync(Future<V> future) throws CoreException { try { - return future.get(); + // use a (long) timeout to avoid eventual deadlocks (in case of resources needing refresh) + return future.get(5, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new CoreException(Status.CANCEL_STATUS); } catch (ExecutionException e) { throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to access the resource shard index", e)); + } catch (TimeoutException e) { + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Timeout during access the resource shard index", e)); } } |