Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val limiters: IMap<String, RateLimiter> = hz.getMap("rest")
- @Before("@annotation(rateLimit)")
- fun rateLimit(jp : JoinPoint, rateLimit: RateLimit){
- //computeIfAbsent is complaining in this case
- val limiter = limiters.computeIfAbsent(createKey(jp), createLimiter(rateLimit))
- }
- private fun createLimiter(limit: RateLimit): kotlin.Function<RateLimiter> {
- val minutesToSeconds = limit.minutes * 60
- return { name: String -> RateLimiter.create(minutesToSeconds.toDouble())}
- }
Advertisement
Add Comment
Please, Sign In to add comment