Package org.mockserver.model
Class PreemptionRequest
java.lang.Object
org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
org.mockserver.model.ObjectWithJsonToString
org.mockserver.model.PreemptionRequest
Declarative request to simulate a server preemption (Kubernetes node drain / Spot
reclamation / a SIGTERM the platform sends before killing the pod): the server cordons itself
(rejecting new exchanges), drains in-flight requests for a bounded window, and optionally signals
HTTP/2 clients to stop with a GOAWAY. It is a simulation only and never actually stops the
JVM or event loops; the cordon auto-clears after
ttlMillis (a dead-man's switch) or on an
explicit uncordon.
Server-scoped (there is no host key): preemption affects the whole MockServer instance. Held by
the PreemptionSimulator singleton.
Follows the model field/withX/getter convention so it round-trips through Jackson
without a bespoke (de)serializer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow new exchanges arriving while cordoned are turned away, and how HTTP/2 clients are told to drain. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleantruewhen the mode signals HTTP/2 clients to drain via a GOAWAY frame.booleangetMode()inthashCode()static PreemptionRequestbooleantruewhen the mode rejects new exchanges with a 503.withDrainMillis(Long drainMillis) withLastStreamId(Long lastStreamId) withTtlMillis(Long ttlMillis) Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toStringMethods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
Constructor Details
-
PreemptionRequest
public PreemptionRequest()
-
-
Method Details
-
preemptionRequest
-
getDrainMillis
-
withDrainMillis
-
getMode
-
withMode
-
getTtlMillis
-
withTtlMillis
-
getLastStreamId
-
withLastStreamId
-
emitsGoAway
public boolean emitsGoAway()truewhen the mode signals HTTP/2 clients to drain via a GOAWAY frame. -
rejectsNew
public boolean rejectsNew()truewhen the mode rejects new exchanges with a 503. -
equals
- Overrides:
equalsin classObjectWithReflectiveEqualsHashCodeToString
-
hashCode
public int hashCode()- Overrides:
hashCodein classObjectWithReflectiveEqualsHashCodeToString
-