Enum Class ShutdownPhase

java.lang.Object
java.lang.Enum<ShutdownPhase>
express.mvp.myra.transport.lifecycle.ShutdownPhase
All Implemented Interfaces:
Serializable, Comparable<ShutdownPhase>, Constable

public enum ShutdownPhase extends Enum<ShutdownPhase>
Represents the phases of transport shutdown.

Shutdown progresses through these phases in order, allowing for graceful resource cleanup and completion of in-flight operations.

Phase Transitions

RUNNING ──▶ DRAINING ──▶ CLOSING ──▶ TERMINATED
             │            │
             └────────────┴─── (timeout can force advancement)

Phase Descriptions

  • RUNNING: Normal operation - accepting new operations
  • DRAINING: Graceful shutdown initiated - no new ops, draining in-flight
  • CLOSING: Drain complete or timeout - closing connections
  • TERMINATED: All resources released - terminal state
See Also:
  • Enum Constant Details

    • RUNNING

      public static final ShutdownPhase RUNNING
      Normal operation phase.

      Transport is fully operational, accepting new connections and I/O operations.

    • DRAINING

      public static final ShutdownPhase DRAINING
      Draining phase - graceful shutdown initiated.

      During this phase:

      • New operations are rejected
      • In-flight operations are allowed to complete
      • No new connections are accepted

      The phase advances to CLOSING when all in-flight operations complete or the drain timeout expires.

    • CLOSING

      public static final ShutdownPhase CLOSING
      Closing phase - actively closing connections.

      During this phase:

      • All connections are being closed
      • Backend resources are being released
      • Buffer pools are being drained
    • TERMINATED

      public static final ShutdownPhase TERMINATED
      Terminal phase - shutdown complete.

      All resources have been released. The transport instance cannot be reused.

  • Method Details

    • values

      public static ShutdownPhase[] 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 ShutdownPhase 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
    • order

      public int order()
      Returns the numeric order of this phase for comparison.
      Returns:
      the phase order (0 = RUNNING, 3 = TERMINATED)
    • displayName

      public String displayName()
      Returns a human-readable name for this phase.
      Returns:
      the display name
    • isBefore

      public boolean isBefore(ShutdownPhase other)
      Checks if this phase is before the specified phase.
      Parameters:
      other - the phase to compare with
      Returns:
      true if this phase comes before the other
    • isAtOrAfter

      public boolean isAtOrAfter(ShutdownPhase other)
      Checks if this phase is at or after the specified phase.
      Parameters:
      other - the phase to compare with
      Returns:
      true if this phase is at or after the other
    • isAcceptingOperations

      public boolean isAcceptingOperations()
      Checks if the transport is accepting new operations.
      Returns:
      true only in RUNNING phase
    • isShuttingDown

      public boolean isShuttingDown()
      Checks if shutdown has been initiated.
      Returns:
      true if in DRAINING, CLOSING, or TERMINATED phase
    • isTerminated

      public boolean isTerminated()
      Checks if shutdown is complete.
      Returns:
      true only in TERMINATED phase
    • toString

      public String toString()
      Overrides:
      toString in class Enum<ShutdownPhase>