ScopedValue.runWhere not returning scope

Andrew Haley aph-open at littlepinkcloud.com
Tue Jun 18 08:43:55 UTC 2024


On 6/17/24 23:15, Robert Engels wrote:
> The “tracing context” is going to be shared across all of the tasks (via
>   the ScopedValue). So if a task does TracingContext.get().newSpan() it
> will clobber other tasks doing the same - i.e. push/pop cannot work. -
> in terms of the “current span” - since the ScopedValue is shared.

Like this, no?

         import static ScopedValue.where;
         ...

         try (var scope = new StructuredTaskScope<String>()) {

             where(CONTEXT, new TraceContext()).run(scope.fork(() -> childTask1()));
             ...
         }

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the loom-dev mailing list