計數器實現限流(單機)

實現時須要注意,用於計數的變量,自增操做應該爲原子操做。java import java.util.concurrent.atomic.AtomicLong; public class RateLimiter { private final static AtomicLong ZERO = new AtomicLong(0); private AtomicLong counte
相關文章
相關標籤/搜索