Package org.mockserver.state
Class ExpectationEntry
java.lang.Object
org.mockserver.state.ExpectationEntry
- All Implemented Interfaces:
Serializable
Serializable entry stored in the expectation
KeyValueStore.
Contains the Expectation definition plus the three sort fields
(priority, created, id) that determine matching order. The live
HttpRequestMatcher is NOT part of this entry — each node builds
it lazily and caches it node-locally.
Implements Serializable with custom serialization: the
Expectation is serialized as its JSON string (via Jackson
ObjectMapper and ExpectationDTO) because the Expectation
domain model classes do not implement Serializable. This keeps
the wire format safe and avoids requiring Serializable on the entire
domain graph.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExpectationEntry(Expectation expectation) ExpectationEntry(ExpectationEntry source, int remainingTimes) Copy constructor for CAS updates: creates a new entry with an updatedremainingTimescounter while preserving all other fields. -
Method Summary
-
Constructor Details
-
ExpectationEntry
-
ExpectationEntry
Copy constructor for CAS updates: creates a new entry with an updatedremainingTimescounter while preserving all other fields. The expectation reference is shared (not cloned) because the entry is only used for the backend CAS swap; node-local matchers hold their own copy.- Parameters:
source- the source entry to copy fromremainingTimes- the new remaining-times value
-
-
Method Details
-
getExpectation
-
getPriority
public int getPriority() -
getCreated
public long getCreated() -
getId
-
getRemainingTimes
public int getRemainingTimes()Returns the shared remaining-times counter.-1indicates unlimited Times (no CAS needed).0or positive indicates the number of remaining matches available for consumption across the cluster. -
isTimesUnlimited
public boolean isTimesUnlimited()Returns whether this entry's expectation has unlimited Times. Equivalent togetRemainingTimes() == -1. -
equals
-
hashCode
public int hashCode() -
toString
-