Package org.apache.solr.servlet
Class RateLimitManager
- java.lang.Object
-
- org.apache.solr.servlet.RateLimitManager
-
- All Implemented Interfaces:
org.apache.solr.common.cloud.ClusterPropertiesListener
@ThreadSafe public class RateLimitManager extends Object implements org.apache.solr.common.cloud.ClusterPropertiesListener
This class is responsible for managing rate limiting per request type. Rate limiters can be registered with this class against a corresponding type. There can be only one rate limiter associated with a request type.The actual rate limiting and the limits should be implemented in the corresponding RequestRateLimiter implementation. RateLimitManager is responsible for the orchestration but not the specifics of how the rate limiting is being done for a specific request type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RateLimitManager.Builder
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CONCURRENT_REQUESTS
static long
DEFAULT_SLOT_ACQUISITION_TIMEOUT_MS
static String
ERROR_MESSAGE
-
Constructor Summary
Constructors Constructor Description RateLimitManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decrementActiveRequests(javax.servlet.http.HttpServletRequest request)
RequestRateLimiter
getRequestRateLimiter(org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
boolean
handleRequest(javax.servlet.http.HttpServletRequest request)
boolean
onChange(Map<String,Object> properties)
void
registerRequestRateLimiter(RequestRateLimiter requestRateLimiter, org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
-
-
-
Field Detail
-
ERROR_MESSAGE
public static final String ERROR_MESSAGE
- See Also:
- Constant Field Values
-
DEFAULT_CONCURRENT_REQUESTS
public static final int DEFAULT_CONCURRENT_REQUESTS
-
DEFAULT_SLOT_ACQUISITION_TIMEOUT_MS
public static final long DEFAULT_SLOT_ACQUISITION_TIMEOUT_MS
- See Also:
- Constant Field Values
-
-
Method Detail
-
onChange
public boolean onChange(Map<String,Object> properties)
- Specified by:
onChange
in interfaceorg.apache.solr.common.cloud.ClusterPropertiesListener
-
handleRequest
public boolean handleRequest(javax.servlet.http.HttpServletRequest request) throws InterruptedException
- Throws:
InterruptedException
-
decrementActiveRequests
public void decrementActiveRequests(javax.servlet.http.HttpServletRequest request)
-
registerRequestRateLimiter
public void registerRequestRateLimiter(RequestRateLimiter requestRateLimiter, org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
-
getRequestRateLimiter
public RequestRateLimiter getRequestRateLimiter(org.apache.solr.client.solrj.SolrRequest.SolrRequestType requestType)
-
-