@ThreadSafe public class BalancerEnabledConfig extends Object
isConfiguredAsEnabled()
and whether it should run shouldBeEnabled()
Constructor and Description |
---|
BalancerEnabledConfig(boolean isEnabled) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isConfiguredAsEnabled() |
boolean |
maybeUpdate(boolean newEnabledValue,
boolean newDemotedBrokersExistValue)
Conditionally updates the config if the supplied values are different than the existing ones.
|
boolean |
maybeUpdateConfigValue(boolean newIsEnabledValue)
Conditionally updates the config's enabled variable.
|
boolean |
maybeUpdateDemotedBrokers(boolean newDemotedBrokersExistValue)
Conditionally updates the config's demoted brokers presence variable.
|
boolean |
shouldBeEnabled() |
String |
toString() |
public BalancerEnabledConfig(boolean isEnabled)
isEnabled
- - the configured enabled statuspublic boolean isConfiguredAsEnabled()
public boolean shouldBeEnabled()
isConfiguredAsEnabled()
in the fact that if there are demoted brokers present,
SBC should not run.public boolean maybeUpdateDemotedBrokers(boolean newDemotedBrokersExistValue)
newDemotedBrokersExistValue
- - whether the cluster has any demoted brokers. In such cases, we want SBC to be temporarily disabled.shouldBeEnabled()
differs with the new values.public boolean maybeUpdateConfigValue(boolean newIsEnabledValue)
newIsEnabledValue
- - whether the config has SBC configured as enabled.shouldBeEnabled()
differs with the new values.public boolean maybeUpdate(boolean newEnabledValue, boolean newDemotedBrokersExistValue)
newEnabledValue
- - the configured SBC enabled statusnewDemotedBrokersExistValue
- - whether the cluster has any demoted brokers. In such cases, we want SBC to be temporarily disabled.shouldBeEnabled()
differs with the new values.