org.aoju.bus.limiter.Handler Maven / Gradle / Ivy
/*********************************************************************************
* *
* The MIT License (MIT) *
* *
* Copyright (c) 2015-2020 aoju.org and other contributors. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy *
* of this software and associated documentation files (the "Software"), to deal *
* in the Software without restriction, including without limitation the rights *
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN *
* THE SOFTWARE. *
********************************************************************************/
package org.aoju.bus.limiter;
import org.aoju.bus.limiter.execute.LimiterExecutionContext;
/**
* 当limiter由于其他原因不能正常工作(如Redis宕机)
* 该接口将会被调用,如果你不希望这些异常影响接口提供服务
* return true,这样将会跳过该limiter,实际上,更好的
* limiter 降级策略应该由limiter本身实现,这里只是一个简单的替代方案
*
* @author Kimi Liu
* @version 6.1.1
* @since JDK 1.8+
*/
public interface Handler {
/**
* @param throwable 异常
* @param executionContext 上下文
* @return true/false
*/
boolean resolve(Throwable throwable, LimiterExecutionContext executionContext);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy