public final TraceContext decorate(TraceContext context) { long traceId = context.traceId(), spanId = context.spanId(); Class<E> type = type(); extra = Collections.singletonList(createExtraAndClaim(traceId, spanId)); return contextWithExtra(context, extra); if (tryToClaim(existing, traceId, spanId)) { consolidated = existing; } else { // otherwise we need to consolidate the fields consolidated = createExtraAndClaim(existing, traceId, spanId); return contextWithExtra(context, Collections.singletonList(consolidated)); extra.add(createExtraAndClaim(traceId, spanId)); return contextWithExtra(context, Collections.unmodifiableList(extra)); E existing = (E) next; if (consolidated == null) { if (tryToClaim(existing, traceId, spanId)) { consolidated = existing; continue; consolidated = createExtraAndClaim(existing, traceId, spanId); extra = ensureMutable(extra); extra.set(i, consolidated); } else { consolidate(existing, consolidated); extra = ensureMutable(extra);
public final TraceContext decorate(TraceContext context) { long traceId = context.traceId(), spanId = context.spanId(); Class<E> type = type(); extra = Collections.singletonList(createExtraAndClaim(traceId, spanId)); return contextWithExtra(context, extra); if (tryToClaim(existing, traceId, spanId)) { consolidated = existing; } else { // otherwise we need to consolidate the fields consolidated = createExtraAndClaim(existing, traceId, spanId); return contextWithExtra(context, Collections.singletonList(consolidated)); extra.add(createExtraAndClaim(traceId, spanId)); return contextWithExtra(context, Collections.unmodifiableList(extra)); E existing = (E) next; if (consolidated == null) { if (tryToClaim(existing, traceId, spanId)) { consolidated = existing; continue; consolidated = createExtraAndClaim(existing, traceId, spanId); extra = ensureMutable(extra); extra.set(i, consolidated); } else { consolidate(existing, consolidated); extra = ensureMutable(extra);