Enum Class RuntimeState
- All Implemented Interfaces:
Serializable,Comparable<RuntimeState>,Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic RuntimeStateReturns the enum constant of this class with the specified name.static RuntimeState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NEW
已创建、尚未启动 -
STARTING
正在启动(doStart()执行中) -
RUNNING
启动成功,正常运行 -
STOPPING
正在关闭(资源清理中) -
STOPPED
已正常关闭,不可再次启动 -
FAILED
启动失败,已完成资源清理,不可再次启动
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-