@Component public class DefaultQueryLimiter extends Object implements QueryLimiter
QueryLimiter.QueryResponse, QueryLimiter.QueryStatistics
Constructor and Description |
---|
DefaultQueryLimiter(ApplicationProperties applicationProperties) |
Modifier and Type | Method and Description |
---|---|
long |
getConcurrentSearchLimit() |
long |
getConcurrentSearchNum() |
QueryLimiter.QueryResponse |
getResponseWithLimit(java.util.function.Supplier<javax.ws.rs.core.Response> responseSupplier,
javax.ws.rs.core.Response quotaExceededResponse)
Allows limiting concurrent number of queries.
|
@Autowired public DefaultQueryLimiter(ApplicationProperties applicationProperties)
public QueryLimiter.QueryResponse getResponseWithLimit(java.util.function.Supplier<javax.ws.rs.core.Response> responseSupplier, javax.ws.rs.core.Response quotaExceededResponse)
QueryLimiter
getResponseWithLimit
in interface QueryLimiter
responseSupplier
- Supplier that will be executed if quota is not exceeded.quotaExceededResponse
- If quota is exceeded it will be returned to the caller.QueryLimiter.QueryResponse
with QueryLimiter.QueryStatistics
and response consisting of: if quota is not exceeded then value returned by responseSupplier
will be used, otherwise quotaExceededResponse
will be used.public long getConcurrentSearchNum()
getConcurrentSearchNum
in interface QueryLimiter
public long getConcurrentSearchLimit()
getConcurrentSearchLimit
in interface QueryLimiter
Copyright © 2002-2022 Atlassian. All Rights Reserved.