/** * Apply new {@link ClusterClientConfig}, while the former config will be replaced. * * @param config new config to apply */ public static void applyNewConfig(ClusterClientConfig config) { clientConfigProperty.updateValue(config); }
/** * Listen to the {@link SentinelProperty} for {@link SystemRule}s. The property is the source * of {@link SystemRule}s. System rules can also be set by {@link #loadRules(List)} directly. * * @param property the property to listen. */ public static void register2Property(SentinelProperty<List<SystemRule>> property) { synchronized (listener) { currentProperty.removeListener(listener); property.addListener(listener); currentProperty = property; } }
private static void removePropertyListener() { clientAssignProperty.removeListener(ASSIGN_PROPERTY_LISTENER); clientConfigProperty.removeListener(CONFIG_PROPERTY_LISTENER); }
public static void register2Property(SentinelProperty<Integer> property) { property.addListener(new SimplePropertyListener<Integer>() { @Override public void configUpdate(Integer value) { if (value != null) { updateSampleCount(value); } } }); }
private static void removePropertyListeners() { for (NamespaceFlowProperty<FlowRule> property : PROPERTY_MAP.values()) { property.getProperty().removeListener(property.getListener()); } }
public static void register2Property(SentinelProperty<Integer> property) { property.addListener(new SimplePropertyListener<Integer>() { @Override public void configUpdate(Integer value) { if (value != null) { updateInterval(value); } } }); }
/** * Load provided server global statistic (flow) configuration to property in memory. * * @param config valid cluster server flow configuration for global */ public static void loadGlobalFlowConfig(ServerFlowConfig config) { globalFlowProperty.updateValue(config); }
public static void registerProperty(SentinelProperty<Integer> property) { synchronized (PROPERTY_LISTENER) { RecordLog.info("[ClusterStateManager] Registering new property to cluster state manager"); stateProperty.removeListener(PROPERTY_LISTENER); property.addListener(PROPERTY_LISTENER); stateProperty = property; } }
private static void removePropertyListeners() { for (NamespaceFlowProperty<ParamFlowRule> property : PROPERTY_MAP.values()) { property.getProperty().removeListener(property.getListener()); } }
private static void bindPropertyListener() { removePropertyListener(); clientAssignProperty.addListener(ASSIGN_PROPERTY_LISTENER); clientConfigProperty.addListener(CONFIG_PROPERTY_LISTENER); }
/** * Load {@link SystemRule}s, former rules will be replaced. * * @param rules new rules to load. */ public static void loadRules(List<SystemRule> rules) { currentProperty.updateValue(rules); }
public static void register2Property(SentinelProperty<List<AuthorityRule>> property) { synchronized (listener) { if (currentProperty != null) { currentProperty.removeListener(listener); } property.addListener(listener); currentProperty = property; RecordLog.info("[AuthorityRuleManager] Registering new property to authority rule manager"); } }
public static void removeProperty(String namespace) { AssertUtil.notEmpty(namespace, "namespace cannot be empty"); synchronized (UPDATE_LOCK) { NamespaceFlowProperty<ParamFlowRule> property = PROPERTY_MAP.get(namespace); if (property != null) { property.getProperty().removeListener(property.getListener()); PROPERTY_MAP.remove(namespace); } RecordLog.info("[ClusterParamFlowRuleManager] Removing property from cluster flow rule manager" + " for namespace <{0}>", namespace); } }
public static void register2Property(SentinelProperty<Integer> property) { property.addListener(new SimplePropertyListener<Integer>() { @Override public void configUpdate(Integer value) { if (value != null) { updateInterval(value); } } }); }
/** * Apply given state to cluster mode. * * @param state valid state to apply */ public static void applyState(Integer state) { stateProperty.updateValue(state); }
/** * Listen to the {@link SentinelProperty} for {@link FlowRule}s. The property is the source of {@link FlowRule}s. * Flow rules can also be set by {@link #loadRules(List)} directly. * * @param property the property to listen. */ public static void register2Property(SentinelProperty<List<FlowRule>> property) { synchronized (LISTENER) { RecordLog.info("[FlowRuleManager] Registering new property to flow rule manager"); currentProperty.removeListener(LISTENER); property.addListener(LISTENER); currentProperty = property; } }
/** * Remove cluster flow rule property for a specific namespace. * * @param namespace valid namespace */ public static void removeProperty(String namespace) { AssertUtil.notEmpty(namespace, "namespace cannot be empty"); synchronized (UPDATE_LOCK) { NamespaceFlowProperty<FlowRule> property = PROPERTY_MAP.get(namespace); if (property != null) { property.getProperty().removeListener(property.getListener()); PROPERTY_MAP.remove(namespace); } RecordLog.info("[ClusterFlowRuleManager] Removing property from cluster flow rule manager" + " for namespace <{0}>", namespace); } }
public static void register2Property(SentinelProperty<Integer> property) { property.addListener(new SimplePropertyListener<Integer>() { @Override public void configUpdate(Integer value) { if (value != null) { updateSampleCount(value); } } }); }
/** * Load the authority rules to memory. * * @param rules list of authority rules */ public static void loadRules(List<AuthorityRule> rules) { currentProperty.updateValue(rules); }
/** * Listen to the {@link SentinelProperty} for {@link ParamFlowRule}s. The property is the source * of {@link ParamFlowRule}s. Parameter flow rules can also be set by {@link #loadRules(List)} directly. * * @param property the property to listen */ public static void register2Property(SentinelProperty<List<ParamFlowRule>> property) { synchronized (PROPERTY_LISTENER) { currentProperty.removeListener(PROPERTY_LISTENER); property.addListener(PROPERTY_LISTENER); currentProperty = property; RecordLog.info("[ParamFlowRuleManager] New property has been registered to hot param rule manager"); } }