diff options
author | John Ross | 2011-11-07 23:11:59 +0000 |
---|---|---|
committer | John Ross | 2011-11-07 23:11:59 +0000 |
commit | 700a442d15ad226b6c762a6adc35507dab45ffcd (patch) | |
tree | c3378bf9886cf6642f69febf363b75b27f29e606 | |
parent | a4b950a8de8cf74a7e57a4f66fba2e12fd63d1c8 (diff) | |
download | rt.equinox.bundles-700a442d15ad226b6c762a6adc35507dab45ffcd.tar.gz rt.equinox.bundles-700a442d15ad226b6c762a6adc35507dab45ffcd.tar.xz rt.equinox.bundles-700a442d15ad226b6c762a6adc35507dab45ffcd.zip |
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.
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 05236274b..9805cd1cd 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 68b807d89..6f13e994d 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 |