Package org.opends.server.api
Record Class ResourceLimits
java.lang.Object
java.lang.Record
org.opends.server.api.ResourceLimits
- Record Components:
sizeLimit
- The maximum number of entries that should be returnedtimeLimitSec
- The maximum length of time in seconds that should be allowed for a searchidleTimeLimitMs
- The idle time limit for the connection in millisecondsmaxCandidateSetSize
- The maximum number of candidate entry IDs the server may retrieve from an index during a search
public record ResourceLimits(int sizeLimit, int timeLimitSec, long idleTimeLimitMs, int maxCandidateSetSize)
extends Record
All resource limits for a user.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ResourceLimits
AResourceLimits
with every value set to unlimited. -
Constructor Summary
ConstructorDescriptionResourceLimits
(int sizeLimit, int timeLimitSec, long idleTimeLimitMs, int maxCandidateSetSize) Creates an instance of aResourceLimits
record class. -
Method Summary
Modifier and TypeMethodDescriptionapplyRequestLimits
(SearchRequest request) Merges this ResourceLimits with the provided limits.applyUserLimits
(Entry user) Return a ResourceLimits using overrides from a user entry, taking into account the limits from a search request.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.long
Returns the value of theidleTimeLimitMs
record component.boolean
isSizeLimitExceeded
(int numberOfEntries) Check if the number of entries has exceeded the size limit.int
Returns the value of themaxCandidateSetSize
record component.int
Returns the value of thesizeLimit
record component.int
Returns the value of thetimeLimitSec
record component.final String
toString()
Returns a string representation of this record class.withMaxCandidateSetSize
(int maxCandidateSetSize) Return a copy of the limits with an updated maxCandidateSetSize.
-
Field Details
-
UNLIMITED
AResourceLimits
with every value set to unlimited.
-
-
Constructor Details
-
ResourceLimits
public ResourceLimits(int sizeLimit, int timeLimitSec, long idleTimeLimitMs, int maxCandidateSetSize) Creates an instance of aResourceLimits
record class.- Parameters:
sizeLimit
- the value for thesizeLimit
record componenttimeLimitSec
- the value for thetimeLimitSec
record componentidleTimeLimitMs
- the value for theidleTimeLimitMs
record componentmaxCandidateSetSize
- the value for themaxCandidateSetSize
record component
-
-
Method Details
-
applyUserLimits
Return a ResourceLimits using overrides from a user entry, taking into account the limits from a search request.- Parameters:
user
- The entry containing possible overrides.- Returns:
- the ResourceLimits
-
isSizeLimitExceeded
public boolean isSizeLimitExceeded(int numberOfEntries) Check if the number of entries has exceeded the size limit.- Parameters:
numberOfEntries
- The number of entries that have been returned- Returns:
true
if the size limit has been exceeded,false
otherwise
-
applyRequestLimits
Merges this ResourceLimits with the provided limits.- Parameters:
request
- The search request with size and time limits- Returns:
- the ResourceLimits
-
withMaxCandidateSetSize
Return a copy of the limits with an updated maxCandidateSetSize.- Parameters:
maxCandidateSetSize
- The maximum candidate set size- Returns:
- the new ResourceLimits
-
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 with '=='. -
sizeLimit
public int sizeLimit()Returns the value of thesizeLimit
record component.- Returns:
- the value of the
sizeLimit
record component
-
timeLimitSec
public int timeLimitSec()Returns the value of thetimeLimitSec
record component.- Returns:
- the value of the
timeLimitSec
record component
-
idleTimeLimitMs
public long idleTimeLimitMs()Returns the value of theidleTimeLimitMs
record component.- Returns:
- the value of the
idleTimeLimitMs
record component
-
maxCandidateSetSize
public int maxCandidateSetSize()Returns the value of themaxCandidateSetSize
record component.- Returns:
- the value of the
maxCandidateSetSize
record component
-