Fixing ConcurrentModificationException

This commit is contained in:
Marcin Grzejszczak
2016-10-04 14:02:00 +02:00
parent d1cb4b2990
commit 7289212868
2 changed files with 2 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ public class ArrayListSpanAccumulator implements SpanReporter {
public List<Span> getSpans() {
synchronized (this.spans) {
return new ArrayList<>(this.spans);
return this.spans;
}
}

View File

@@ -113,7 +113,7 @@ public class WebClientTests {
then(getHeader(response, Span.TRACE_ID_NAME)).isNull();
then(getHeader(response, Span.SPAN_ID_NAME)).isNull();
then(this.listener.getSpans()).isNotEmpty();
Optional<Span> noTraceSpan = this.listener.getSpans().stream().filter(span ->
Optional<Span> noTraceSpan = new ArrayList<>(this.listener.getSpans()).stream().filter(span ->
"http:/notrace".equals(span.getName()) && !span.tags().isEmpty()).findFirst();
then(noTraceSpan.isPresent()).isTrue();
// TODO: matches cause there is an issue with Feign not providing the full URL at the interceptor level