aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2011-11-07 18:11:59 (EST)
committerJohn Ross2011-11-07 18:11:59 (EST)
commit700a442d15ad226b6c762a6adc35507dab45ffcd (patch)
treec3378bf9886cf6642f69febf363b75b27f29e606
parenta4b950a8de8cf74a7e57a4f66fba2e12fd63d1c8 (diff)
downloadrt.equinox.bundles-700a442d15ad226b6c762a6adc35507dab45ffcd.zip
rt.equinox.bundles-700a442d15ad226b6c762a6adc35507dab45ffcd.tar.gz
rt.equinox.bundles-700a442d15ad226b6c762a6adc35507dab45ffcd.tar.bz2
Bug 362232 - [coordinator] Add support for the new, mandatory orphaned coordination requirement.
Modified CoordinationReferent.equals to return false if the object is not an instance of CoordinationReferent. In addition to the one listed below, this change required a couple of other changes to CoordinationImpl methods that were still returning CoordinationImpl instead of CoordinationReferent. Updated the while loop for unwinding the thread local stack in CoordinationImpl.end to compare apples to apples.
-rw-r--r--bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java9
-rw-r--r--bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationReferent.java8
2 files changed, 11 insertions, 6 deletions
diff --git a/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java b/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java
index 0523627..9805cd1 100644
--- a/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java
+++ b/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java
@@ -126,7 +126,8 @@ public class CoordinationImpl implements Coordination {
}
// Unwind the stack in case there are other coordinations higher
// up than this one.
- while (!coordinator.peek().equals(this)) {
+ CoordinationReferent referent = new CoordinationReferent(this);
+ while (!coordinator.peek().equals(referent)) {
try {
coordinator.peek().end();
} catch (CoordinationException e) {
@@ -255,7 +256,9 @@ public class CoordinationImpl implements Coordination {
public synchronized Coordination getEnclosingCoordination() {
coordinator.checkPermission(CoordinationPermission.ADMIN, name);
- return enclosingCoordination;
+ if (enclosingCoordination == null)
+ return null;
+ return new CoordinationReferent(enclosingCoordination);
}
public Throwable getFailure() {
@@ -315,7 +318,7 @@ public class CoordinationImpl implements Coordination {
checkTerminated();
coordinator.push(this);
}
- return this;
+ return new CoordinationReferent(this);
}
synchronized Date getDeadline() {
diff --git a/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationReferent.java b/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationReferent.java
index 68b807d..6f13e99 100644
--- a/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationReferent.java
+++ b/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationReferent.java
@@ -88,9 +88,11 @@ public class CoordinationReferent implements Coordination {
@Override
public boolean equals(Object object) {
- if (object instanceof CoordinationReferent)
- return coordination.equals(((CoordinationReferent)object).coordination);
- return coordination.equals(object);
+ if (object == this)
+ return true;
+ if (!(object instanceof CoordinationReferent))
+ return false;
+ return coordination.equals(((CoordinationReferent)object).coordination);
}
@Override