Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2018-05-01 17:29:43 +0000
committerGenevieve Bastien2018-05-02 20:18:31 +0000
commitf429bde3e40c8ccc297b81cc343546c6b03c7ebf (patch)
tree035654f49333380a0f55ee5c181a5d109b039d21 /callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/CallStackDepth.java
parentfd68941c8c672f55f2a9b2ca09f059f7670560d8 (diff)
downloadorg.eclipse.tracecompass.incubator-f429bde3e40c8ccc297b81cc343546c6b03c7ebf.tar.gz
org.eclipse.tracecompass.incubator-f429bde3e40c8ccc297b81cc343546c6b03c7ebf.tar.xz
org.eclipse.tracecompass.incubator-f429bde3e40c8ccc297b81cc343546c6b03c7ebf.zip
callstack: Fix callstack concurrency exceptions
The CallStackDepth class used by data provider should use the object ID of the callstack in its hash code, as 2 objects will be equivalent if they refer to the same callstack, no matter its content. Also, avoid concurrency exceptions while building by synchronizing access to attribute updates Change-Id: Idb806ab30e9b6d063ecbdce2a94cb045e8404200 Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/121975 Tested-by: CI Bot Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Diffstat (limited to 'callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/CallStackDepth.java')
-rw-r--r--callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/CallStackDepth.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/CallStackDepth.java b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/CallStackDepth.java
index fbcf8da16..2a408e0cd 100644
--- a/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/CallStackDepth.java
+++ b/callstack/org.eclipse.tracecompass.incubator.callstack.core/src/org/eclipse/tracecompass/incubator/callstack/core/instrumented/CallStackDepth.java
@@ -59,7 +59,10 @@ public class CallStackDepth {
@Override
public int hashCode() {
- return Objects.hashCode(fCallstack, fDepth);
+ // Compare with the actual callstack object, as the callstack's own hash may
+ // change as the callstack is built. Here, we are looking for the same object,
+ // no matter its content
+ return Objects.hashCode(System.identityHashCode(fCallstack), fDepth);
}
@Override
@@ -68,7 +71,10 @@ public class CallStackDepth {
return false;
}
CallStackDepth csd = (CallStackDepth) obj;
- return Objects.equal(fCallstack, csd.fCallstack) && (fDepth == csd.fDepth);
+ // Compare with the actual callstack object, as the callstack's own hash may
+ // change as the callstack is built. Here, we are looking for the same object,
+ // no matter its content
+ return Objects.equal(System.identityHashCode(fCallstack), System.identityHashCode(csd.fCallstack)) && (fDepth == csd.fDepth);
}
@Override

Back to the top