Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-07-20 18:43:04 +0000
committerMichael Valenta2004-07-20 18:43:04 +0000
commit333de1a9d5969576dab22fb8ff2541c1f9e606b1 (patch)
tree764d3ed41d86223484da60e64d90d1bfa93c0b63
parent30b973ba72b87ece429fde4f167e0093e8aacefb (diff)
downloadeclipse.platform.team-333de1a9d5969576dab22fb8ff2541c1f9e606b1.tar.gz
eclipse.platform.team-333de1a9d5969576dab22fb8ff2541c1f9e606b1.tar.xz
eclipse.platform.team-333de1a9d5969576dab22fb8ff2541c1f9e606b1.zip
Bug 70445 eclipse freezes during CVSM20040720
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java45
3 files changed, 48 insertions, 23 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
index fbe51c54d..8735040af 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesView.java
@@ -75,7 +75,7 @@ public class RepositoriesView extends RemoteViewPart {
IRepositoryListener listener = new IRepositoryListener() {
public void repositoryAdded(final ICVSRepositoryLocation root) {
- getViewer().getControl().getDisplay().syncExec(new Runnable() {
+ getViewer().getControl().getDisplay().asyncExec(new Runnable() {
public void run() {
refreshViewer();
getViewer().setSelection(new StructuredSelection(root));
@@ -90,7 +90,7 @@ public class RepositoriesView extends RemoteViewPart {
}
private void refresh() {
Display display = getViewer().getControl().getDisplay();
- display.syncExec(new Runnable() {
+ display.asyncExec(new Runnable() {
public void run() {
RepositoriesView.this.refreshViewer();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
index c12f34926..dfdc20491 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
@@ -33,6 +33,7 @@ public class RepositoryRoot extends PlatformObject {
Map autoRefreshFiles = new HashMap();
// Map of String (module name) -> ICVSRemoteFolder (that is a defined module)
Map modulesCache;
+ Object modulesCacheLock = new Object();
// Lis of date tags
List dateTags = new ArrayList();
@@ -92,18 +93,19 @@ public class RepositoryRoot extends PlatformObject {
private Map getDefinedModulesCache(CVSTag tag, IProgressMonitor monitor) {
if (modulesCache == null) {
- modulesCache = new HashMap();
- synchronized(modulesCache) {
- try {
- ICVSRemoteResource[] folders = root.members(CVSTag.DEFAULT, true, monitor);
+ try {
+ // Fetch the modules before locking the cache (to avoid deadlock)
+ ICVSRemoteResource[] folders = root.members(CVSTag.DEFAULT, true, monitor);
+ synchronized(modulesCacheLock) {
+ modulesCache = new HashMap();
for (int i = 0; i < folders.length; i++) {
ICVSRemoteResource resource = folders[i];
modulesCache.put(resource.getName(), resource);
}
- } catch (CVSException e) {
- // we could't fetch the modules. Log the problem and continue
- CVSUIPlugin.log(e);
}
+ } catch (CVSException e) {
+ // we could't fetch the modules. Log the problem and continue
+ CVSUIPlugin.log(e);
}
}
return modulesCache;
@@ -499,9 +501,9 @@ public class RepositoryRoot extends PlatformObject {
* RepositoriesView is pressed.
*/
void clearCache() {
- if (modulesCache == null) return;
- synchronized(modulesCache) {
- modulesCache = null;
+ synchronized(modulesCacheLock) {
+ if (modulesCache != null)
+ modulesCache = null;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
index 8b52c33cd..978f121fe 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ModuleSelectionPage.java
@@ -51,6 +51,9 @@ public class ModuleSelectionPage extends CVSWizardPage {
private String helpContextId;
private boolean supportsMultiSelection;
+ private boolean isFetchingModules = false;
+ private Object fetchingModulesLock = new Object();
+
public ModuleSelectionPage(String pageName, String title, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
}
@@ -132,29 +135,49 @@ public class ModuleSelectionPage extends CVSWizardPage {
moduleList.getControl().setEnabled(true);
moduleName = null;
if (moduleList.getInput() == null || updateModulesList) {
+ boolean fetchModules = false;
// The input is set after the page is shown to avoid
// fetching if the user wants to specify the name manually
try {
- // Validate the location first since the module fecthing is
- // done in a deferred fashion
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- location.validateConnection(monitor);
- } catch (CVSException e) {
- throw new InvocationTargetException(e);
- }
+ // This can be called from different events in the event loop.
+ // Ensure that we only fetch the input once
+ synchronized (fetchingModulesLock) {
+ if (!isFetchingModules) {
+ // This the first thread in so fetch the modules
+ fetchModules = true;
+ isFetchingModules = true;
}
- });
+ }
+ if (fetchModules) {
+ // Validate the location first since the module fecthing is
+ // done in a deferred fashion
+ getContainer().run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ location.validateConnection(monitor);
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ setModuleListInput();
+ }
} catch (InvocationTargetException e) {
if (!badLocation) {
badLocation = true;
CVSUIPlugin.openError(getShell(), null, null, e);
+ // This will null the module list input
+ setModuleListInput();
}
} catch (InterruptedException e) {
// Canceled by the user
+ } finally {
+ synchronized (fetchingModulesLock) {
+ if (fetchModules) {
+ isFetchingModules = false;
+ }
+ }
}
- setModuleListInput();
}
setPageComplete(internalGetSelectedModules().length > 0);
}

Back to the top