Module bus.limiter

Class Sentinel

java.lang.Object
org.miaixz.bus.limiter.Sentinel

public class Sentinel extends Object
Sentinel execution class for applying various limiting and protection strategies. This class integrates with Alibaba Sentinel to enforce flow control, hotspot protection, and fallback mechanisms based on configured rules.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • Sentinel

      public Sentinel()
  • Method Details

    • process

      public static Object process(Object bean, Method method, Object[] args, String name, StrategyMode strategyMode)
      Executes the given method with the specified limiting strategy. This method acts as an entry point for applying different protection strategies (fallback, hotspot, request limit) before or during method invocation.
      Parameters:
      bean - The target object on which the method is to be invoked.
      method - The Method to be executed.
      args - The arguments to be passed to the method.
      name - The resource name associated with the method for Sentinel rules.
      strategyMode - The StrategyMode to apply (FALLBACK, HOT_METHOD, REQUEST_LIMIT).
      Returns:
      The result of the method invocation, or a fallback value if a strategy is triggered.
      Throws:
      org.miaixz.bus.core.lang.exception.InternalException - if an unsupported StrategyMode is provided.