Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-03-01 17:32:26 +0000
committerMichael Valenta2004-03-01 17:32:26 +0000
commitc8baa99343deaf9e95cf9053a437e73955c6219b (patch)
tree9fed2e21379041e9a26b546acaf39b6e1d86b5a7
parent699c5d9fd519aec16c0f812436cd838d18d4159c (diff)
downloadeclipse.platform.team-c8baa99343deaf9e95cf9053a437e73955c6219b.tar.gz
eclipse.platform.team-c8baa99343deaf9e95cf9053a437e73955c6219b.tar.xz
eclipse.platform.team-c8baa99343deaf9e95cf9053a437e73955c6219b.zip
Fixed some concurrency problems
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java19
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java13
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java17
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java3
4 files changed, 39 insertions, 13 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
index 8597675c0..d47d885bf 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/subscribers/SubscriberSyncInfoCollector.java
@@ -10,12 +10,24 @@
*******************************************************************************/
package org.eclipse.team.core.subscribers;
-import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoFilter;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.core.subscribers.*;
+import org.eclipse.team.internal.core.Policy;
+import org.eclipse.team.internal.core.subscribers.SubscriberEventHandler;
+import org.eclipse.team.internal.core.subscribers.SyncSetInputFromSubscriber;
+import org.eclipse.team.internal.core.subscribers.SyncSetInputFromSyncSet;
+import org.eclipse.team.internal.core.subscribers.WorkingSetSyncSetInput;
/**
* This collector maintains a {@link SyncInfoSet} for a particular team subscriber keeping
@@ -112,6 +124,7 @@ public final class SubscriberSyncInfoCollector implements IResourceChangeListene
Thread.sleep(10);
} catch (InterruptedException e) {
}
+ Policy.checkCanceled(monitor);
}
monitor.worked(1);
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
index 20b05e581..325abd873 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/synchronize/SyncInfoSet.java
@@ -479,12 +479,15 @@ public class SyncInfoSet {
* while the listeners are notified so listeners must be cautious in order to avoid deadlock.
*/
public void endInput(IProgressMonitor monitor) {
- if (lock.getDepth() == 1) {
- // Remain locked while firing the events so the handlers
- // can expect the set to remain constant while they process the events
- fireChanges(Policy.monitorFor(monitor));
+ try {
+ if (lock.getDepth() == 1) {
+ // Remain locked while firing the events so the handlers
+ // can expect the set to remain constant while they process the events
+ fireChanges(Policy.monitorFor(monitor));
+ }
+ } finally {
+ lock.release();
}
- lock.release();
}
protected void resetChanges() {
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
index cdb8019e1..a37c9dfa7 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SubscriberEventHandler.java
@@ -274,14 +274,23 @@ public class SubscriberEventHandler extends BackgroundEventHandler {
// Create a monitor that will handle preemptions and dispatch if required
IProgressMonitor collectionMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN) {
+ boolean dispatching = false;
public void subTask(String name) {
- handlePreemptiveEvents(this);
- handlePendingDispatch(this);
+ dispatch();
super.subTask(name);
}
+ private void dispatch() {
+ if (dispatching) return;
+ try {
+ dispatching = true;
+ handlePreemptiveEvents(this);
+ handlePendingDispatch(this);
+ } finally {
+ dispatching = false;
+ }
+ }
public void worked(int work) {
- handlePreemptiveEvents(this);
- handlePendingDispatch(this);
+ dispatch();
super.worked(work);
}
};
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java
index 3935cffe8..78bc96003 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/SyncSetInput.java
@@ -48,8 +48,9 @@ public abstract class SyncSetInput {
* obtain the contents from the input source.
*/
public void reset(IProgressMonitor monitor) throws TeamException {
- syncSet.beginInput();
+
try {
+ syncSet.beginInput();
monitor = Policy.monitorFor(monitor);
monitor.beginTask(null, 100);
syncSet.clear();

Back to the top