Enum Class Liveness

java.lang.Object
java.lang.Enum<Liveness>
com.botwithus.bot.api.runtime.Liveness
All Implemented Interfaces:
Serializable, Comparable<Liveness>, Constable

public enum Liveness extends Enum<Liveness>
How responsive a script runner is, as judged by the runtime's watchdog.

Orthogonal to ScriptHealth, which records crashes. A script that has never thrown is ScriptHealth.HEALTHY and can still be ABANDONED: refusing to stop is not the same failure as throwing.

LIVE and STALLED are recoverable — a runner moves freely between them as onLoop calls start and finish. REVOKED and ABANDONED are terminal: both mean the runtime has given up on the thread ever draining and has stopped trusting it, and neither is ever left.

  • Enum Constant Details

    • LIVE

      public static final Liveness LIVE
      Looping normally, or parked between loops.
    • STALLED

      public static final Liveness STALLED
      Still inside a single onLoop call past the watchdog's threshold. Advisory when no stop is pending — a blocking walk legitimately parks inside onLoop for minutes — and the first stage of the stop escalation once one is.
    • REVOKED

      public static final Liveness REVOKED
      Stop was requested, the thread did not drain, and the runtime has cut the runner off from the game: every RPC it attempts from here on throws. Most stuck scripts unwind on their own at this point, because they are usually looping on an API call rather than spinning in pure computation. Terminal.
    • ABANDONED

      public static final Liveness ABANDONED
      Revoked and still alive. The thread cannot be killed — Java has no Thread.stop — so it is quarantined instead: kept visible to the user, and its classloader pinned so a reload never closes it underneath. Terminal.
  • Method Details

    • values

      public static Liveness[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Liveness valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isTerminal

      public boolean isTerminal()
      true for the states a runner can never leave.