Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-09-11 13:48:45 -0400
committerMichael Valenta2003-09-11 13:48:45 -0400
commitd3216abd8a360ac477a584dbc8564a938c3da434 (patch)
tree221b3ee2303ba425e0096512aaacb55049508789
parent0907bc683857217fc7f769e55b78e88df60fecea (diff)
downloadeclipse.platform.team-d3216abd8a360ac477a584dbc8564a938c3da434.tar.gz
eclipse.platform.team-d3216abd8a360ac477a584dbc8564a938c3da434.tar.xz
eclipse.platform.team-d3216abd8a360ac477a584dbc8564a938c3da434.zip
Conforming to new Core API
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java39
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java5
5 files changed, 35 insertions, 28 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
index ee1af1fc0..615e2e067 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSWorkspaceSubscriber.java
@@ -160,9 +160,9 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
IResource resource = resources[i];
final IProgressMonitor infinite = Policy.infiniteSubMonitorFor(monitor, 100);
try {
- // We need to do a scheduling rule on the project because
- // the EclipseSynchronizer currently obtains rules which causes
- // many workers to be created (see bug 41979).
+ // We need to do a scheduling rule on the project to
+ // avoid overly desctructive operations from occuring
+ // while we gather sync info
Platform.getJobManager().beginRule(resource);
infinite.beginTask(null, 512);
resource.accept(new IResourceVisitor() {
@@ -184,7 +184,7 @@ public class CVSWorkspaceSubscriber extends CVSSyncTreeSubscriber implements IRe
} catch (CoreException e) {
throw CVSException.wrapException(e);
} finally {
- Platform.getJobManager().endRule();
+ Platform.getJobManager().endRule(resource);
infinite.done();
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java
index 1a43bfd86..2ba099996 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java
@@ -49,7 +49,9 @@ public class ReentrantLock {
private Set changedResources = new HashSet();
private Set changedFolders = new HashSet();
private IFlushOperation operation;
- public ThreadInfo(IFlushOperation operation) {
+ private ISchedulingRule schedulingRule;
+ public ThreadInfo(ISchedulingRule schedulingRule, IFlushOperation operation) {
+ this.schedulingRule = schedulingRule;
this.operation = operation;
}
public void increment() {
@@ -95,6 +97,9 @@ public class ReentrantLock {
private void handleAbortedFlush(Throwable t) {
CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, Policy.bind("ReentrantLock.9"), t)); //$NON-NLS-1$
}
+ public ISchedulingRule getSchedulingRule() {
+ return schedulingRule;
+ }
}
public interface IFlushOperation {
@@ -114,14 +119,14 @@ public class ReentrantLock {
}
public synchronized void acquire(IResource resource, IFlushOperation operation) {
- lock(resource);
- incrementNestingCount(resource, operation);
+ ISchedulingRule ruleUsed = lock(resource);
+ incrementNestingCount(resource, ruleUsed, operation);
}
- private void incrementNestingCount(IResource resource, IFlushOperation operation) {
+ private void incrementNestingCount(IResource resource, ISchedulingRule rule, IFlushOperation operation) {
ThreadInfo info = getThreadInfo();
if (info == null) {
- info = new ThreadInfo(operation);
+ info = new ThreadInfo(rule, operation);
Thread thisThread = Thread.currentThread();
infos.put(thisThread, info);
if(DEBUG) System.out.println("[" + thisThread.getName() + "] acquired CVS lock on " + resource.getFullPath()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -129,29 +134,27 @@ public class ReentrantLock {
info.increment();
}
- private void lock(IResource resource) {
+ private ISchedulingRule lock(IResource resource) {
// The scheduling rule is either the project or the resource's parent
ISchedulingRule rule;
if (resource.getType() == IResource.ROOT) {
// Never lock the whole workspace
- rule = new ISchedulingRule() {
- public boolean contains(ISchedulingRule innerRule) {
- return false;
- }
- public boolean isConflicting(ISchedulingRule innerRule) {
- return false;
- }
- };
+ rule = null;
} else if (resource.getType() == IResource.PROJECT) {
rule = resource;
} else {
rule = resource.getParent();
}
- Platform.getJobManager().beginRule(rule);
+ if (rule != null) {
+ Platform.getJobManager().beginRule(rule);
+ }
+ return rule;
}
- private void unlock() {
- Platform.getJobManager().endRule();
+ private void unlock(ISchedulingRule rule) {
+ if (rule != null) {
+ Platform.getJobManager().endRule(rule);
+ }
}
/**
@@ -169,7 +172,7 @@ public class ReentrantLock {
if(DEBUG) System.out.println("[" + thisThread.getName() + "] released CVS lock"); //$NON-NLS-1$ //$NON-NLS-2$
infos.remove(thisThread);
info.flush(monitor);
- unlock();
+ unlock(info.getSchedulingRule());
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
index eedfcdd6f..c55c93766 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
@@ -27,6 +27,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -227,10 +228,11 @@ public class RemoteTagSynchronizer extends CVSRemoteSynchronizer {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
+ ISchedulingRule rule = resource.getProject();
try {
// Get a scheduling rule on the project since CVS may obtain a lock higher then
// the resource itself.
- JobManager.getInstance().beginRule(resource.getProject());
+ JobManager.getInstance().beginRule(rule);
monitor.setTaskName(Policy.bind("RemoteTagSynchronizer.0", resource.getFullPath().makeRelative().toString())); //$NON-NLS-1$
@@ -246,7 +248,7 @@ public class RemoteTagSynchronizer extends CVSRemoteSynchronizer {
sub.done();
}
} finally {
- JobManager.getInstance().endRule();
+ JobManager.getInstance().endRule(rule);
}
}
} finally {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
index 84564153f..55a927010 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutIntoOperation.java
@@ -119,13 +119,14 @@ public class CheckoutIntoOperation extends CheckoutOperation {
*/
protected void checkout(ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException {
monitor.beginTask(null, 100);
+ ISchedulingRule rule = getSchedulingRule();
try {
// Obtain a scheduling rule on the projects were about to overwrite
- Platform.getJobManager().beginRule(getSchedulingRule());
+ Platform.getJobManager().beginRule(rule);
super.checkout(folders, Policy.subMonitorFor(monitor, 90));
refreshRoot(getLocalRoot(getLocalFolder()), Policy.subMonitorFor(monitor, 10));
} finally {
- Platform.getJobManager().endRule();
+ Platform.getJobManager().endRule(rule);
monitor.done();
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
index 6a2f7c810..65f21975c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CheckoutProjectOperation.java
@@ -148,13 +148,14 @@ public abstract class CheckoutProjectOperation extends CheckoutOperation {
return OK;
}
+ ISchedulingRule rule = getSchedulingRule(targetProjects);
try {
// Obtain a scheduling rule on the projects were about to overwrite
- Platform.getJobManager().beginRule(getSchedulingRule(targetProjects));
+ Platform.getJobManager().beginRule(rule);
IStatus result = performCheckout(session, resource, targetProjects, project != null, Policy.subMonitorFor(pm, 90));
return result;
} finally {
- Platform.getJobManager().endRule();
+ Platform.getJobManager().endRule(rule);
}
} catch (CVSException e) {
// An exception occurred either during the module-expansion or checkout

Back to the top