const classafConcurrent::LocalRef

sys::Obj
  afConcurrent::LocalRef

@Js

Manages an Obj reference stored in Actor.locals with a unique key.

cleanUp

Source

Void cleanUp()

Removes this object from Actor.locals.

isMapped

Source

Bool isMapped()

Returns true if Actor.locals holds an entry for this qname.

makeWithFunc

Source

new makeWithFunc(Str name, |->Obj?? defFunc := null)

Creates a LocalRef with given name.

If not null, defFunc is called to create a default object whenever val is read and a value is not mapped in Actor.locals. This object is then stored and returned. This allows the creation of non-const default objects in multiple threads.

initFunc must be immutable.

name

Source

const Str name

The variable name given to the ctor.

qname

Source

const Str qname

The qualified name this ThreadLocal is stored under in Actor.locals. qname is calculated from name.

toStr

Source

virtual override Str toStr()

Returns a string representation the referenced value.

val

Source

Obj? val

The object held in Actor.locals. If a value is not mapped when read, initFunc() is called to create a default object.