Package com.jsgalactic.axiom.execution
Record Class ExecutionBudget
java.lang.Object
java.lang.Record
com.jsgalactic.axiom.execution.ExecutionBudget
- Record Components:
aggregate- bounds all executions and supplies the policy of routes without an overrideroutePolicies- immutable additional bounds keyed by registered route identity
public record ExecutionBudget(AdmissionPolicy aggregate, Map<Route,AdmissionPolicy> routePolicies)
extends Record
Immutable application-wide execution budget. The aggregate policy bounds requests from every
listener and test client of one application; a route override bounds that route in addition to
the aggregate. The counters behind the budget belong to the application, so no listener has a
private copy of its capacity.
-
Constructor Summary
ConstructorsConstructorDescriptionExecutionBudget(AdmissionPolicy aggregate, Map<Route, AdmissionPolicy> routePolicies) Validates the aggregate and copies the overrides into an immutable map, so later changes to a caller's map cannot change this budget. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaggregaterecord component.static ExecutionBudgetdefaults()Creates the default budget: no queue, 36 active executions and no route overrides.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static ExecutionBudgetof(AdmissionPolicy aggregate) Creates a budget with no route overrides.Returns the policy that bounds a route: its override when present, otherwise the aggregate.Returns the value of theroutePoliciesrecord component.final StringtoString()Returns a string representation of this record class.withoutRoute(Route route) Returns a budget without the bound of one route, leaving the aggregate and other overrides as they are.withRoute(Route route, AdmissionPolicy policy) Returns a budget with one route bound replaced, leaving the aggregate and other overrides as they are.
-
Constructor Details
-
ExecutionBudget
Validates the aggregate and copies the overrides into an immutable map, so later changes to a caller's map cannot change this budget.
-
-
Method Details
-
of
Creates a budget with no route overrides.- Parameters:
aggregate- bounds all executions of the application- Returns:
- budget whose every route uses the aggregate policy
-
defaults
Creates the default budget: no queue, 36 active executions and no route overrides.- Returns:
- the unchanged default budget
-
policy
Returns the policy that bounds a route: its override when present, otherwise the aggregate.- Parameters:
route- registered route identity- Returns:
- effective admission policy
-
withRoute
Returns a budget with one route bound replaced, leaving the aggregate and other overrides as they are.- Parameters:
route- route identity whose bound is replacedpolicy- new bound for that route- Returns:
- a new budget; this one is unchanged
-
withoutRoute
Returns a budget without the bound of one route, leaving the aggregate and other overrides as they are. Removing an override that is not present has no effect.- Parameters:
route- route identity whose override is removed- Returns:
- a new budget; this one is unchanged
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
aggregate
Returns the value of theaggregaterecord component.- Returns:
- the value of the
aggregaterecord component
-
routePolicies
Returns the value of theroutePoliciesrecord component.- Returns:
- the value of the
routePoliciesrecord component
-