All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ltd.fdsa.starter.limiter.thread.AbstractAddTokenThread Maven / Gradle / Ivy

There is a newer version: 1.1.1
Show newest version
package ltd.fdsa.starter.limiter.thread;

import lombok.Data;
import ltd.fdsa.starter.limiter.annotation.LimitTraffic;
import org.springframework.data.redis.core.RedisTemplate;

import java.lang.reflect.Method;

@Data
public abstract class AbstractAddTokenThread implements Runnable {
    private RedisTemplate redisTemplate;
    private Method method;
    private LimitTraffic limitTraffic;

    public AbstractAddTokenThread(
            RedisTemplate redisTemplate, Method method, LimitTraffic limitTraffic) {
        this.redisTemplate = redisTemplate;
        this.method = method;
        this.limitTraffic = limitTraffic;
    }

    /**
     * Start adding tokens
     *
     * @param redisTemplate redisTemplate
     * @param method        method
     * @param limitTraffic  limitTraffic
     */
    protected abstract void startAddingTokens(
            RedisTemplate redisTemplate, Method method, LimitTraffic limitTraffic);

    @Override
    public void run() {
        startAddingTokens(redisTemplate, method, limitTraffic);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy