Skip to content

Commit

Permalink
Merge pull request #2224 from DedunuKarunarathne/master
Browse files Browse the repository at this point in the history
Handle ConcurrentModificationException in OpenTelemetry
  • Loading branch information
DedunuKarunarathne authored Oct 16, 2024
2 parents 695642e + 58e7371 commit 476da0b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

/**
* Controls Jaeger spans, with respect to various events received during Synapse message flow.
Expand Down Expand Up @@ -203,13 +204,13 @@ private void startSpan(StatisticDataUnit statisticDataUnit, MessageContext synCt
Span span;
Map<String, String> tracerSpecificCarrier = new HashMap<>();

Map headersMap = (Map) ((Axis2MessageContext) synCtx).getAxis2MessageContext()
.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
Map headersMap = new ConcurrentHashMap<>((Map) ((Axis2MessageContext) synCtx).getAxis2MessageContext()
.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS));
Object statusCode = ((Axis2MessageContext) synCtx).getAxis2MessageContext().getProperty("HTTP_SC");
Object statusDescription = ((Axis2MessageContext) synCtx).getAxis2MessageContext().getProperty("HTTP_DESC");
// We only need to extract span context from headers when there are trp headers available
if (headersMap == null) {
headersMap = new HashMap();
headersMap = new ConcurrentHashMap();
}
if (isOuterLevelSpan(statisticDataUnit, spanStore)) {
// Extract span context from headers
Expand Down

0 comments on commit 476da0b

Please sign in to comment.