Loading topic
ScopedValue. It assumes you know Java lambdas, static fields, final, and the call stack. Familiarity with ThreadLocal helps but isn't required. The previous chapters explained why implicit context is awkward. Here the focus is the declaration itself, becaus5 min readstatic final fields. You should also have declared a ScopedValue, as covered in the previous chapter. Here you will learn how a value gets attached to a call, how long it stays attached, and what the bindin4 min readScopedValue and bind it with where(...).run(...), as in the earlier chapters. It also assumes you know what a lambda is and what the call stack is.5 min readScopedValue and bind it with ScopedValue.where(...).run(...). It also assumes you know that exceptions propagate up the call stack. Here you will see what a read does when no binding is active, which methods let you handle that case, and the situations that5 min readScopedValue and bind it with ScopedValue.where(...).run(...). It also assumes you can read the value with get, and that you are comfortable with lambdas and the call stack. If the feature is still a preview API in your JDK, compile and run with `--enable-5 min readCarrier object works, how partial rebinding behaves, and when a4 min readRunnable, and that you know how static final fields and the call stack work. It also assumes you have already seen ScopedValue.where(...).run(...) in earlier chapters. Here you learn two rules that define scoped values: a binding exists only while 5 min readThreadLocal at least once. It compares the two tools on mutability, lifetime, and cost. It ends with rules for choosing between them.6 min readScopedValue.where(...).run(...) binds a value and how get, isBound, and orElse read it. It covers what happens when the code inside a scope starts other threads.5 min readScopedValue, bind it with where(...).run(...), and read it with get. You should also know that a plain new Thread does not inherit bindings. You need a rough idea of what a thread pool and a Callable are. You don't need prior experience with structure4 min readScopedValue and bind it with where(...).run(...). It also assumes you know the basics of ThreadLocal, and that you have seen virtual threads (Thread.ofVirtual() or Executors.newVirtualThreadPerTaskExecutor()). Earlier chapters covered the othe5 min readThreadLocal works, how ScopedValue.where(...).run(...) binds a value, and how get, isBound, and orElse read it. Here you will convert existing ThreadLocal code, and you will learn which code should stay as it is.4 min readScopedValue, bind it with where(...).run(...), and read it with get, isBound, orElse and orElseThrow. You also need to know how ThreadLocal6 min read