const classafConcurrent::LocalRef
sys::Obj afConcurrent::LocalRef
@Js
Manages an Obj reference stored in Actor.locals with a unique key.
- cleanUp
Void cleanUp()Removes this object from
Actor.locals.- isMapped
Bool isMapped()Returns
trueifActor.localsholds an entry for thisqname.- makeWithFunc
new makeWithFunc(Str name, |->Obj?? defFunc := null)Creates a
LocalRefwith given name.If not null,
defFuncis called to create a default object whenevervalis read and a value is not mapped inActor.locals. This object is then stored and returned. This allows the creation of non-const default objects in multiple threads.initFuncmust be immutable.- name
const Str nameThe variable name given to the ctor.
- qname
const Str qnameThe qualified name this
ThreadLocalis stored under inActor.locals.qnameis calculated fromname.- toStr
virtual override Str toStr()Returns a string representation the referenced value.
- val
Obj? valThe object held in
Actor.locals. If a value is not mapped when read,initFunc()is called to create a default object.