java.lang.Object
org.miaixz.bus.limiter.metric.FallbackProvider
- All Implemented Interfaces:
Serializable,org.miaixz.bus.core.Provider,Provider
Implements the
Provider interface for handling the FALLBACK strategy mode. This provider is responsible for
invoking a fallback method when the primary method execution is blocked or fails due to limiting rules.- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()Returns the strategy mode supported by this provider, which isStrategyMode.FALLBACK.Processes the method invocation by attempting to find and invoke a fallback method.
-
Constructor Details
-
FallbackProvider
public FallbackProvider()
-
-
Method Details
-
get
Returns the strategy mode supported by this provider, which isStrategyMode.FALLBACK.- Specified by:
getin interfaceProvider- Returns:
- The
StrategyMode.FALLBACKenum value.
-
process
Processes the method invocation by attempting to find and invoke a fallback method. The fallback method is expected to have the same parameters as the original method and its name should be the original method name appended with "Fallback".- Specified by:
processin interfaceProvider- Parameters:
bean- The target object on which the original method was invoked.method- The originalMethodthat was attempted to be executed.args- The arguments passed to the original method invocation.- Returns:
- The result of the fallback method invocation.
- Throws:
RuntimeException- if a suitable fallback method cannot be found for the given bean and method.
-