<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">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.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 10, 2024, at 11:21 AM, Marcin Grzejszczak <<a href="mailto:marcin.grzejszczak@gmail.com" class="">marcin.grzejszczak@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">> What would a Scope object look like? What would you do with one?</div><div class=""><br class=""></div><div class="">Essentially it would be Closeable. I would store it in e.g. `onScopeOpened` and then pass it onto `onScopeClosed` and close it there.<br class=""></div><div class=""><br class=""></div><div class=""><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">Pozdrawiam / Best regards,</div><div class="">Marcin Grzejszczak</div><div class=""><br class=""><div class=""><a href="https://marcin.grzejszczak.pl/" target="_blank" class="">https://marcin.grzejszczak.pl</a></div><div class=""><a href="https://toomuchcoding.com/" target="_blank" class="">https://toomuchcoding.com</a></div></div></div></div></div></div></div><br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">pon., 10 cze 2024 o 16:17 Andrew Haley <<a href="mailto:aph-open@littlepinkcloud.com" class="">aph-open@littlepinkcloud.com</a>> napisaĆ(a):<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 6/10/24 15:48, Marcin Grzejszczak wrote:<br class="">
> Do I understand correctly that ScopedValues will be significantly faster<br class="">
> than Thread Locals?<br class="">
<br class="">
In some cases, yes.<br class="">
<br class="">
> If that's the case just by returning a Scope object<br class="">
> instead of expecting a lambda all the tracing libraries and all<br class="">
> instrumentations that are out there will not need a major redesign. I think<br class="">
> that it's worthwhile to consider such an option in that scenario.<br class="">
<br class="">
I don't understand this.<br class="">
<br class="">
What would a Scope object look like? What would you do with one?<br class="">
<br class="">
-- <br class="">
Andrew Haley (he/him)<br class="">
Java Platform Lead Engineer<br class="">
Red Hat UK Ltd. <<a href="https://www.redhat.com/" rel="noreferrer" target="_blank" class="">https://www.redhat.com</a>><br class="">
<a href="https://keybase.io/andrewhaley" rel="noreferrer" target="_blank" class="">https://keybase.io/andrewhaley</a><br class="">
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671<br class="">
<br class="">
</blockquote></div>
</div></blockquote></div><br class=""></body></html>