Documentation / dataflow-async / com.femastudios.dataflow.async / WeakWorstStatusWrapper
Go to reference

WeakWorstStatusWrapper

interface WeakWorstStatusWrapper : Field<AttributeData<Nothing?>>, AutoCloseable

This Field contains the worst status between all the provided attributes.

You can add watched attributes with the addAttribute method and remove them with the removeAttribute method.

If all attribute are Loaded this field will have a Loaded value. Otherwise it will have a Error or Loading status, depending on attribute values and the preferLoading preference.

IMPORTANT: Since this WeakWorstStatusWrapper is build to handle thousands of Attributes, a special thread to batch and do computations is created. When you are done using this class, you HAVE TO call close, otherwise memory leaks will occur.

Properties

preferLoading

Whether to prefer a Loading status over an Error status. Default value is false.

abstract var preferLoading: Boolean

Functions

addAttribute

Adds the given attribute to the list of watched statuses

abstract fun addAttribute(attribute: Attribute<*>): Unit

close

You have to call this method when you are done using this WeakWorstStatusWrapper to avoid memory leaks. This is necessary since thi class uses it's own thread to do computations

abstract fun close(): Unit

removeAttribute

Removes the given attribute from the list of watched statuses

abstract fun removeAttribute(attribute: Attribute<*>): Unit

retry

Invokes the retry function on all attributes in an Error state that have a retry function.

abstract fun retry(): Unit

Companion Object Functions

create

Creates a new WeakWorstStatusWrapper

fun create(): WeakWorstStatusWrapper