Module bus.limiter

Class StrategyManager

java.lang.Object
org.miaixz.bus.limiter.metric.StrategyManager

public class StrategyManager extends Object
Manages and provides access to different limiting strategy implementations. This class acts as a registry for Provider instances, mapping each StrategyMode to its corresponding provider responsible for executing that strategy.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • StrategyManager

      public StrategyManager()
  • Method Details

    • add

      public static void add(Provider provider)
      Adds a Provider to the strategy manager. The provider is registered under its associated StrategyMode.
      Parameters:
      provider - The Provider instance to be added.
    • get

      public static Provider get(StrategyMode strategyMode)
      Retrieves the Provider responsible for executing a specific StrategyMode.
      Parameters:
      strategyMode - The StrategyMode for which to retrieve the provider.
      Returns:
      The Provider instance associated with the given strategy mode, or null if not found.