Enum Class ShutdownPhase
- All Implemented Interfaces:
Serializable, Comparable<ShutdownPhase>, Constable
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 operationsDRAINING: Graceful shutdown initiated - no new ops, draining in-flightCLOSING: Drain complete or timeout - closing connectionsTERMINATED: All resources released - terminal state
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionClosing phase - actively closing connections.Draining phase - graceful shutdown initiated.Normal operation phase.Terminal phase - shutdown complete. -
Method Summary
Modifier and TypeMethodDescriptionReturns a human-readable name for this phase.booleanChecks if the transport is accepting new operations.booleanisAtOrAfter(ShutdownPhase other) Checks if this phase is at or after the specified phase.booleanisBefore(ShutdownPhase other) Checks if this phase is before the specified phase.booleanChecks if shutdown has been initiated.booleanChecks if shutdown is complete.intorder()Returns the numeric order of this phase for comparison.toString()static ShutdownPhaseReturns the enum constant of this class with the specified name.static ShutdownPhase[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
RUNNING
Normal operation phase.Transport is fully operational, accepting new connections and I/O operations.
-
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
CLOSINGwhen all in-flight operations complete or the drain timeout expires. -
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
Terminal phase - shutdown complete.All resources have been released. The transport instance cannot be reused.
-
-
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
-
order
public int order()Returns the numeric order of this phase for comparison.- Returns:
- the phase order (0 = RUNNING, 3 = TERMINATED)
-
displayName
-
isBefore
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
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
RUNNINGphase
-
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
TERMINATEDphase
-
toString
- Overrides:
toStringin classEnum<ShutdownPhase>
-