Package com.xebialabs.xlrelease.limits
Class LimitEnforcer
java.lang.Object
com.xebialabs.xlrelease.limits.LimitEnforcer
Central utility for enforcing tenant limits across XL Release.
- Since:
- 25.3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum defining different types of limits that can be enforced -
Constructor Summary
ConstructorsConstructorDescriptionLimitEnforcer(com.xebialabs.xlrelease.repository.TenantLimitRepository tenantLimitRepository) -
Method Summary
Modifier and TypeMethodDescriptionvoidenforceLimit(String tenantId, LimitEnforcer.LimitType limitType, int increment, IntSupplier currentCountSupplier) Enforces a specific limit by checking current count against configured limit.
-
Constructor Details
-
LimitEnforcer
public LimitEnforcer(com.xebialabs.xlrelease.repository.TenantLimitRepository tenantLimitRepository)
-
-
Method Details
-
enforceLimit
public void enforceLimit(String tenantId, LimitEnforcer.LimitType limitType, int increment, IntSupplier currentCountSupplier) Enforces a specific limit by checking current count against configured limit.- Parameters:
tenantId- The tenant id for which limit should be checkedlimitType- The type of limit to validateincrement- Number of items to be addedcurrentCountSupplier- Supplier to get current count (lazy evaluation)- Throws:
com.xebialabs.xlrelease.exception.RateLimitReachedException- if the action would exceed the limit
-