Class RateLimiter
java.lang.Object
org.gridgain.internal.mcp.ratelimit.RateLimiter
Central rate limiter that manages per-tool token buckets.
Singleton pattern ensures consistent rate limiting across all tools.
-
Method Summary
Modifier and TypeMethodDescriptioncheckLimit(String toolName, int perMinute) Checks rate limit for a specific tool.intGets the default rate limit.static RateLimiterGets the singleton instance.booleanChecks if rate limiting is enabled.voidreset()Resets all rate limit buckets (primarily for testing).
-
Method Details
-
getInstance
Gets the singleton instance. -
checkLimit
Checks rate limit for a specific tool.- Parameters:
toolName- Name of the tool being rate limitedperMinute- Rate limit for this tool (use -1 for default)- Returns:
- RateLimitResult indicating if request is allowed
-
isEnabled
public boolean isEnabled()Checks if rate limiting is enabled. -
getDefaultLimitPerMinute
public int getDefaultLimitPerMinute()Gets the default rate limit. -
reset
public void reset()Resets all rate limit buckets (primarily for testing).
-