Package com.jsgalactic.axiom.execution
Record Class AdmissionPolicy
java.lang.Object
java.lang.Record
com.jsgalactic.axiom.execution.AdmissionPolicy
- Record Components:
maxActive- maximum reserved or running executionsmaxQueued- maximum requests waiting for execution capacityqueueTimeout- maximum wait; zero exactly when queuing is disabled
Immutable execution limits. A zero queue capacity means immediate rejection when busy.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLargest acceptedmaxQueued; bounds memory held by waiting requests. -
Constructor Summary
ConstructorsConstructorDescriptionAdmissionPolicy(int maxActive, int maxQueued, Duration queueTimeout) Validates limits before they can be installed. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxActiverecord component.intReturns the value of themaxQueuedrecord component.Returns the value of thequeueTimeoutrecord component.static AdmissionPolicyreject(int maxActive) Configures immediate rejection when the active limit is occupied.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
MAX_QUEUED_LIMIT
public static final int MAX_QUEUED_LIMITLargest acceptedmaxQueued; bounds memory held by waiting requests.- See Also:
-
-
Constructor Details
-
AdmissionPolicy
Validates limits before they can be installed.- Parameters:
maxActive- positive active limitmaxQueued- queue limit from zero toMAX_QUEUED_LIMITqueueTimeout- positive wait of at most one day, or zero for no queue
-
-
Method Details
-
reject
Configures immediate rejection when the active limit is occupied.- Parameters:
maxActive- positive active limit- Returns:
- policy without a waiting queue
-
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 '=='. -
maxActive
public int maxActive()Returns the value of themaxActiverecord component.- Returns:
- the value of the
maxActiverecord component
-
maxQueued
public int maxQueued()Returns the value of themaxQueuedrecord component.- Returns:
- the value of the
maxQueuedrecord component
-
queueTimeout
Returns the value of thequeueTimeoutrecord component.- Returns:
- the value of the
queueTimeoutrecord component
-