Package org.languagetool
Enum Class RemoteRuleFallbackManager
- All Implemented Interfaces:
Serializable,Comparable<RemoteRuleFallbackManager>,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, RemoteRuleConfig> private final AtomicBoolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetInhouseFallback(String ruleId) voidInitialize RemoteRuleFallbackManager from remoteRuleConfigFile, can only been called oncevoidinit_for_tests_only(List<RemoteRuleConfig> config) This method is only for internal tests and must not been called from production codeisRuleOrFallbackAvailable(RemoteRule rule, Map<String, RemoteRule> remoteRules) Check the current status of the circuitBreaker of a remoteRule, and get the fallback option if not availableprivate StringisRuleOrFallbackAvailable(RemoteRule rule, Map<String, RemoteRule> remoteRules, Set<String> visited) private voidsetup(List<RemoteRuleConfig> finalConfig) static RemoteRuleFallbackManagerReturns the enum constant of this class with the specified name.static RemoteRuleFallbackManager[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Field Details
-
initCalled
-
fallbackConfigs
-
-
Constructor Details
-
RemoteRuleFallbackManager
private RemoteRuleFallbackManager()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
init
Initialize RemoteRuleFallbackManager from remoteRuleConfigFile, can only been called once- Parameters:
remoteRuleConfigFile-
-
init_for_tests_only
This method is only for internal tests and must not been called from production code- Parameters:
config-
-
setup
-
getInhouseFallback
- Parameters:
ruleId- a remote RuleId- Returns:
- the RemoteRuleConfig for the given RuleId
-
isRuleOrFallbackAvailable
@Nullable public String isRuleOrFallbackAvailable(@NotNull RemoteRule rule, @NotNull Map<String, RemoteRule> remoteRules) Check the current status of the circuitBreaker of a remoteRule, and get the fallback option if not available- Parameters:
rule-remoteRules-- Returns:
- A RuleId: 1. Same RuleID as rule.getId() -> The rule is available 2. Other RuleID as rule.getId() -> The rule is not available, and you get the fallbackID 3. Null -> The rule is not available and has no available fallbacks
-
isRuleOrFallbackAvailable
@Nullable private String isRuleOrFallbackAvailable(@NotNull RemoteRule rule, @NotNull Map<String, RemoteRule> remoteRules, Set<String> visited)
-