Package com.tnsai.resilience
Record Class ResilienceConfig
java.lang.Object
java.lang.Record
com.tnsai.resilience.ResilienceConfig
- Record Components:
retry- retry policy, ornullfor no retrytimeoutMs- per-attempt timeout in ms;<= 0means no timeout
Programmatic resilience policy for a builder-built
Role
— the builder-path counterpart of the @Resilience annotation
(TNS-567). Without it, a role created via RoleBuilder could only get a
resilience policy by subclassing; now it attaches one with
RoleBuilder.resilience(...) and ActionExecutor applies it
through the same ResilienceExecutor path as the annotation.
Scope — enforced subset only
This models the@Resilience features that are actually applied at
runtime today: retry (RetryPolicy) and
timeout. The annotation's circuitBreaker,
rateLimit, bulkhead and fallback are scaffold that
ActionExecutor.applyResilience does not yet honor (Phase 2 of TNS-565),
so they are deliberately not modeled here — a builder field for an
unenforced feature would be a silent no-op. They will be added once the
runtime wires them.- Since:
- 0.12.0 (TNS-567)
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResilienceConfig(RetryPolicy retry, int timeoutMs) Creates an instance of aResilienceConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ResilienceConfig.Builderbuilder()final booleanIndicates whether some other object is "equal to" this one.static ResilienceConfigfrom(Resilience annotation) Adapts the enforced subset of a@Resilienceannotation (retry + timeout).final inthashCode()Returns a hash code value for this object.booleanisEmpty()True when neither retry nor timeout is configured.retry()Returns the value of theretryrecord component.intReturns the value of thetimeoutMsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NONE
No resilience policy.
-
-
Constructor Details
-
Method Details
-
isEmpty
public boolean isEmpty()True when neither retry nor timeout is configured. -
from
Adapts the enforced subset of a@Resilienceannotation (retry + timeout). The annotation's not-yet-wired fields (circuitBreaker, rateLimit, bulkhead, fallback) are ignored — see the class scope note. -
builder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
retry
Returns the value of theretryrecord component.- Returns:
- the value of the
retryrecord component
-
timeoutMs
public int timeoutMs()Returns the value of thetimeoutMsrecord component.- Returns:
- the value of the
timeoutMsrecord component
-