ScopedValue.runWhere not returning scope

Robert Engels robaho at icloud.com
Mon Jun 10 16:25:34 UTC 2024


I think the question is more - what are the threads doing with this object between the open and close. This is what controls whether or not the object can be immutable - which from my reading is the general design/limitation of a scoped variable.

> On Jun 10, 2024, at 11:21 AM, Marcin Grzejszczak <marcin.grzejszczak at gmail.com> wrote:
> 
> > What would a Scope object look like? What would you do with one?
> 
> Essentially it would be Closeable. I would store it in e.g. `onScopeOpened` and then pass it onto `onScopeClosed` and close it there.
> 
> Pozdrawiam / Best regards,
> Marcin Grzejszczak
> 
> https://marcin.grzejszczak.pl <https://marcin.grzejszczak.pl/>
> https://toomuchcoding.com <https://toomuchcoding.com/>
> 
> pon., 10 cze 2024 o 16:17 Andrew Haley <aph-open at littlepinkcloud.com <mailto:aph-open at littlepinkcloud.com>> napisał(a):
> On 6/10/24 15:48, Marcin Grzejszczak wrote:
> > Do I understand correctly that ScopedValues will be significantly faster
> > than Thread Locals?
> 
> In some cases, yes.
> 
> > If that's the case just by returning a Scope object
> > instead of expecting a lambda all the tracing libraries and all
> > instrumentations that are out there will not need a major redesign. I think
> > that it's worthwhile to consider such an option in that scenario.
> 
> I don't understand this.
> 
> What would a Scope object look like? What would you do with one?
> 
> -- 
> Andrew Haley  (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com <https://www.redhat.com/>>
> https://keybase.io/andrewhaley <https://keybase.io/andrewhaley>
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20240610/2348ff9f/attachment-0001.htm>


More information about the loom-dev mailing list