package com.yeejoin.amos.boot.module.jg.biz.interceptor;

import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Administrator
 */
public class ClearThreadLocalInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){
        FlowingEquipRedisContext.clean();
        return true;
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response,Object handler, Exception ex) {
        // 清除ThreadLocal变量
        FlowingEquipRedisContext.clean();
    }


}