Enum Class RuntimeState

java.lang.Object
java.lang.Enum<RuntimeState>
io.github.theword.queqiao.core.runtime.RuntimeState
All Implemented Interfaces:
Serializable, Comparable<RuntimeState>, Constable

public enum RuntimeState extends Enum<RuntimeState>
QueQiaoRuntime 的生命周期状态

采用"一次创建、一次启动、一次关闭"模型,状态迁移是单向的:

 NEW ──start()──> STARTING ──成功──> RUNNING ──shutdown()──> STOPPING ──> STOPPED
                                └──失败──> FAILED
 

不支持重新启动:STOPPED / FAILED / RUNNING / STARTING 状态下调用 start() 都会抛出 IllegalStateException。 需要"重启"时应创建新的 Runtime 实例,而不是复用旧实例。

NEW 状态下调用 shutdown() 是 no-op,状态保持 NEW, 因此"先 shutdown 再 start"仍然可行。

Since:
0.7.0
  • Enum Constant Details

    • NEW

      public static final RuntimeState NEW
      已创建、尚未启动
    • STARTING

      public static final RuntimeState STARTING
      正在启动(doStart() 执行中)
    • RUNNING

      public static final RuntimeState RUNNING
      启动成功,正常运行
    • STOPPING

      public static final RuntimeState STOPPING
      正在关闭(资源清理中)
    • STOPPED

      public static final RuntimeState STOPPED
      已正常关闭,不可再次启动
    • FAILED

      public static final RuntimeState FAILED
      启动失败,已完成资源清理,不可再次启动
  • Method Details

    • values

      public static RuntimeState[] 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 RuntimeState 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