Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-06-03 14:34:10 +0000
committerMichael Valenta2004-06-03 14:34:10 +0000
commit49fd4d0f57e6e891d3b5944b16caf013cc6bdbdc (patch)
tree917006e195af751e060601fb749514164f453a01
parentb145eced39ac1de8ae7c187da927b4fa093e37c0 (diff)
downloadeclipse.platform.team-49fd4d0f57e6e891d3b5944b16caf013cc6bdbdc.tar.gz
eclipse.platform.team-49fd4d0f57e6e891d3b5944b16caf013cc6bdbdc.tar.xz
eclipse.platform.team-49fd4d0f57e6e891d3b5944b16caf013cc6bdbdc.zip
Bug 64773 OutOfMemory during checkout does not free rule.
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java24
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java6
2 files changed, 21 insertions, 9 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
index d12ae0930..bdf89e9e1 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/subscribers/BatchingLock.java
@@ -73,18 +73,26 @@ public class BatchingLock {
// The scheduling rule is either the project or the resource's parent
ISchedulingRule rule = getRuleForResoure(resource);
if (rule != NULL_SCHEDULING_RULE) {
+ boolean success = false;
try {
Platform.getJobManager().beginRule(rule, monitor);
- } catch (OperationCanceledException e) {
- // The begin was cancelled.
- // Free the scheduling rule and throw the cancel
- // so the clients of ReentrantLock don't need to
- // do an endRule when the operation is cancelled.
- Platform.getJobManager().endRule(rule);
- throw e;
+ addRule(rule);
+ success = true;
+ } finally {
+ if (!success) {
+ try {
+ Platform.getJobManager().endRule(rule);
+ } catch (RuntimeException e) {
+ // Log and ignore so the original exception is not lost
+ TeamPlugin.log(IStatus.ERROR, "Failed to end scheduling rule", e); //$NON-NLS-1$
+ }
+ }
}
+ } else {
+ // Record the fact that we didn't push a rule so we
+ // can match it when we pop
+ addRule(rule);
}
- addRule(rule);
return rule;
}
/**
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 ecaf921fe..83c54fe22 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
@@ -79,6 +79,7 @@ public class ReentrantLock {
boolean success = false;
try {
Platform.getJobManager().beginRule(rule, monitor);
+ addRule(rule);
success = true;
} finally {
if (!success) {
@@ -94,8 +95,11 @@ public class ReentrantLock {
}
}
}
+ } else {
+ // Record the fact that we didn't push a rule so we
+ // can match it when we pop
+ addRule(rule);
}
- addRule(rule);
return rule;
}
/**

Back to the top