@Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
            throws IOException, ServletException {
        final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
        final HttpServletResponse response = (HttpServletResponse) servletResponse;
        
        Method method = controllerMethodsCache.getMethod(httpServletRequest);
        try {
            if (method != null && method.isAnnotationPresent(TpsControl.class)
                    && TpsControlConfig.isTpsControlEnabled()) {
                TpsControl tpsControl = method.getAnnotation(TpsControl.class);
                String pointName = tpsControl.pointName();
                String parserName = StringUtils.isBlank(tpsControl.name()) ? pointName : tpsControl.name();
                HttpTpsCheckRequestParser parser = HttpTpsCheckRequestParserRegistry.getParser(parserName);
                TpsCheckRequest httpTpsCheckRequest = null;
                if (parser != null) {
                    httpTpsCheckRequest = parser.parse(httpServletRequest);
                }
                if (httpTpsCheckRequest == null) {
                    httpTpsCheckRequest = new TpsCheckRequest();
                }
                if (StringUtils.isBlank(httpTpsCheckRequest.getPointName())) {
                    httpTpsCheckRequest.setPointName(pointName);
                }
                initTpsControlManager();
                TpsCheckResponse checkResponse = tpsControlManager.check(httpTpsCheckRequest);
                if (!checkResponse.isSuccess()) {
                    AsyncContext asyncContext = httpServletRequest.startAsync();
                    asyncContext.setTimeout(0);
                    RpcScheduledExecutor.CONTROL_SCHEDULER.schedule(
                            () -> generate503Response(httpServletRequest, response, checkResponse.getMessage(),
                                    asyncContext), 1000L, TimeUnit.MILLISECONDS);
                    return;
                }
                
            }
        } catch (Throwable throwable) {
            Loggers.TPS.warn("Fail to  http tps check", throwable);
        }
        
        filterChain.doFilter(httpServletRequest, response);
    }
@Test
    void testTpsCheckException() throws Exception {
        HttpTpsCheckRequestParserRegistry.register(new HttpTpsCheckRequestParser() {
            @Override
            public TpsCheckRequest parse(HttpServletRequest httpServletRequest) {
                return new TpsCheckRequest();
            }
            
            @Override
            public String getPointName() {
                return "HealthCheck";
            }
            
            @Override
            public String getName() {
                return "HealthCheck";
            }
        });
        
        when(tpsControlManager.check(any(TpsCheckRequest.class))).thenThrow(new RuntimeException("324565"));
        
        //mock http tps control method
        Method method = HealthCheckRequestHandler.class.getMethod("handle", Request.class, RequestMeta.class);
        
        HttpServletRequest httpServletRequest = Mockito.mock(HttpServletRequest.class);
        HttpServletResponse httpServletResponse = Mockito.mock(HttpServletResponse.class);
        MockFilterChain filterChain = Mockito.mock(MockFilterChain.class);
        
        when(controllerMethodsCache.getMethod(eq(httpServletRequest))).thenReturn(method);
        //execute test.
        nacosHttpTpsFilter.doFilter(httpServletRequest, httpServletResponse, filterChain);
        
        //verify
        Mockito.verify(filterChain, Mockito.times(1)).doFilter(httpServletRequest, httpServletResponse);
        
    }