Menu

class: threadState

[23:6] static extends: object

Defines the state of the thread. One of these should be returned from getThreadState.

Members

  • st_new
  • st_runnable
  • st_blocked
  • st_waiting
  • st_timed_waiting
  • st_terminated

class: Thread

[43:14] (extern: com.lehman.aussomserver.stdlib.AussomThread) extends: object

The thread class implements threading functionality. The Aussom-Server implementation mirrors the Aussom CLI Thread API exactly so apps that use threads work the same way under both runtimes. Server-only behavior: when started, threads are registered with the per-app LiveResources tracker so reload and shutdown can join them, and the default thread name is namespaced as "aussom-app--N" for log attribution.

Methods

  • setOnRun (callback Callback)

    Sets the on run callback function.

    • @p Callback is the function to be called on run.
    • @r This object.
  • startThread ()

    Starts the thread.

    • @r This object.
  • sleep (int MillsToWait = 0)

    Sleeps the provided number of milliseconds.

    • @p MillsToWait is an int with the number of milliseconds to wait.
    • @r This object.
  • interrupt ()

    Interrupts the thread.

    • @r This object.
  • setPriority (int Priority = 5)

    Sets the priority of the thread.

    • @p Priority is an int with the priority to set.
    • @r This object.
  • setName (string Name)

    Sets the thread name.

    • @p Name is a string to set for the thread name.
    • @r This object.
  • setDaemon (bool SetDaemon = true)

    Sets the thread as a daemon. The thread cannot already be alive when this is called.

    • @p SetDaemon is a bool with the flag.
    • @r This object.
  • start ()

    Starts the thread. If no on-run callback has been set this binds the user's overridden run() method.

    • @r This object.
  • run ()

    Default run() to override. The base prints a warning and exits so a misconfigured Thread is loud in logs.

  • isInterrupted ()

    Gets the is interrupted flag.

    • @r A bool with the is interrupted flag.
  • isAlive ()

    Gets the is alive flag.

    • @r A bool with the is alive flag.
  • getPriority ()

    Gets the thread priority.

    • @r An int with the thread priority.
  • join (int MillsToWait = 0)

    Joins the thread, waiting up to MillsToWait milliseconds. 0 waits forever.

    • @p MillsToWait is an int with the milliseconds to wait.
    • @r This object.
  • isDaemon ()

    Gets the is daemon flag.

    • @r A bool with the is daemon flag.
  • toString ()

    Returns the Java representation of the thread.

    • @r A string with the thread info.
  • getId ()

    Gets the thread ID.

    • @r An int with the thread ID.
  • getThreadState ()

    Gets the thread state.

    • @r A string with the thread state. See the threadState enum for available values.
  • getOnRun ()

    Gets the on run function.

    • @r A callback with the on run function.

class: Timer

[180:14] (extern: com.lehman.aussomserver.stdlib.AussomTimer) extends: object

The Timer class implements timer functionality. Mirrors the Aussom CLI Timer API. Server-only behavior: timers are registered with the per-app LiveResources tracker on start so a reload of the owning app can cancel them. Timer callbacks are wrapped in a try/catch so a throwing callback does not silently kill the underlying java.util.Timer thread (a footgun on a long-running server).

Methods

  • Timer (int TimeMills, callback OnTimeOut)

    Constructs a new Timer.

    • @p TimeMills is the number of milliseconds for the timer.
    • @p OnTimeOut is a callback fired when the timer elapses.
    • @r This object.
  • newTimer (int TimeMills, callback OnTimeOut)

  • start ()

    Starts the timer to run only once.

    • @r This object.
  • startInterval ()

    Starts the timer to run repeatedly at the configured interval.

    • @r This object.
  • stop ()

    Stops the timer.

    • @r This object.
  • restart ()

    Restarts a one-shot timer.

    • @r This object.
  • setDuration (int TimeMills)

    Sets the timer duration in milliseconds.

    • @p TimeMills is an int with the duration.
    • @r This object.
  • getDuration ()

    Gets the timer duration.

    • @r An int with the duration in milliseconds.