1
|
/**
|
2
|
* Copyright (C) 2021 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.api.service.security;
|
10
|
|
11
|
import java.time.Duration;
|
12
|
|
13
|
/**
|
14
|
* @author a.kohlbecker
|
15
|
* @since Nov 18, 2021
|
16
|
*/
|
17
|
public interface IRateLimitedService {
|
18
|
|
19
|
/**
|
20
|
* Requests to the service methods should be rate limited.
|
21
|
* This method allows to set the timeout when waiting for a
|
22
|
* free execution slot. {@link #RATE_LIMTER_TIMEOUT_SECONDS}
|
23
|
* is the default
|
24
|
*/
|
25
|
void setRateLimiterTimeout(Duration timeout);
|
26
|
|
27
|
|
28
|
/**
|
29
|
* see {@link #setRateLimiterTimeout(Duration)}
|
30
|
*
|
31
|
* @return the currently used timeout
|
32
|
*/
|
33
|
Duration getRateLimiterTimeout();
|
34
|
|
35
|
/**
|
36
|
* Requests to the service methods should be rate limited.
|
37
|
* This method allows to override the default rate
|
38
|
* {@link #PERMITS_PER_SECOND}
|
39
|
*/
|
40
|
public void setRate(double rate);
|
41
|
|
42
|
}
|