Guest User

Untitled

a guest
Nov 29th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1.     val limiters: IMap<String, RateLimiter> = hz.getMap("rest")
  2.  
  3.     @Before("@annotation(rateLimit)")
  4.     fun rateLimit(jp : JoinPoint, rateLimit: RateLimit){
  5.         //computeIfAbsent is complaining in this case
  6.         val limiter = limiters.computeIfAbsent(createKey(jp), createLimiter(rateLimit))
  7.     }
  8.  
  9.     private fun createLimiter(limit: RateLimit): kotlin.Function<RateLimiter> {
  10.         val minutesToSeconds = limit.minutes * 60
  11.         return { name: String -> RateLimiter.create(minutesToSeconds.toDouble())}
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment