Class LifeCycle

In Log4g, the main interface for handling the life cycle context of an object is this one.

An object first starts in the LifeCycle.State.INITIALIZED state by default to indicate the class has been loaded. From here, calling the Start() method will change this state to LifeCycle.State.STARTING. After successfully being started, this state is changed to LifeCycle.State.STARTED. When the Stop() is called, this goes into the LifeCycle.State.STOPPING state. After successfully being stopped, this goes into the LifeCycle.State.STOPPED state. In most circumstances, implementation classes should store their LifeCycle.State in a volatile field dependent on synchronization and concurrency requirements. Subclassing 'Object'.

Info:

  • Copyright: GrayWolf64
  • License: Apache License 2.0

Tables

lifecycle.State LifeCycle states.

Methods

lifecycle:SetState (state) Sets the LifeCycle state.
lifecycle:GetState () Gets the LifeCycle state.


Tables

lifecycle.State
LifeCycle states.

Fields:

  • INITIALIZING Object is in its initial state and not yet initialized.
  • INITIALIZED Initialized but not yet started.
  • STARTING In the process of starting.
  • STARTED Has started.
  • STOPPING Stopping is in progress.
  • STOPPED Has stopped.

Methods

lifecycle:SetState (state)
Sets the LifeCycle state.

Parameters:

  • state A function in the State table which returns a string representing the state
lifecycle:GetState ()
Gets the LifeCycle state.

Returns:

    function state
generated by LDoc 1.5.0 Last updated 2023-07-17 09:58:50