kieker-monitoring / kieker

Kieker's main repository
Apache License 2.0
70 stars 41 forks source link

[KIEKER-530] ExecutionTrace, export set or copy of set #1056

Open rju opened 1 week ago

rju commented 1 week ago

JIRA Issue: KIEKER-530 ExecutionTrace, export set or copy of set Original Reporter: Jan Waller


#!java
/**
 * Returns a sorted set (unmodifiable) of {@link Execution}s in this trace.
 * 
 * @return the sorted set of {@link Execution}s in this trace
 */
public final SortedSet<Execution> getTraceAsSortedExecutionSet() {
    synchronized (this) {
        // TODO copy set? depends on whether later changes should be reflected ...
        return Collections.unmodifiableSortedSet(this.set);
    }
}

Checklist:

rju commented 3 days ago

author André van Hoorn -- Mon, 29 Jul 2013 16:55:55 +0200

Check whether add is called after getTraceAsSortedExecutionSet

rju commented 3 days ago

author André van Hoorn -- Mon, 2 Sep 2013 14:58:57 +0200

Replying to [avh|comment:4]:
> Check whether add is called after getTraceAsSortedExecutionSet

The add and getTraceAsSortedExecutionSet methods are currently called from the following places:

rju commented 3 days ago

author André van Hoorn -- Mon, 2 Sep 2013 16:18:12 +0200

Add comment that internal list returned (unmodifiable)

rju commented 3 days ago

author André van Hoorn -- Thu, 5 Sep 2013 15:20:15 +0200

Replying to [avh|comment:6]:
> Add comment that internal list returned (unmodifiable)

Extended the method comment in changeset:cad3fadaf4170cd9c79f918f95b610f19f21ce04/kieker-git

diff --git a/src/tools/kieker/tools/traceAnalysis/systemModel/ExecutionTrace.java b/src/tools/kieker/tools/traceAnalysis/systemModel/ExecutionTrace
index d42d272..8f12521 100644
--- a/src/tools/kieker/tools/traceAnalysis/systemModel/ExecutionTrace.java
+++ b/src/tools/kieker/tools/traceAnalysis/systemModel/ExecutionTrace.java
 -202,6 +202,10  public class ExecutionTrace extends AbstractTrace {
        /**
         * Returns a sorted set (unmodifiable) of {link Execution}s in this trace.
         * 
+        * Note that the returned data structure is the (wrapped )internal data structure of this {link ExecutionTrace} object, to which further elements may be added
+        * by the {link ExecutionTrace#add(Execution)} method. Consider to create a copy of the returned list, while synchronizing on this (i.e., the
+        * {link ExecutionTrace}) object.
+        * 
         * return the sorted set of {link Execution}s in this trace
         */
        public final SortedSet<Execution> getTraceAsSortedExecutionSet() {