public static void register2Property(SentinelProperty<Integer> property) { property.addListener(new SimplePropertyListener<Integer>() { @Override public void configUpdate(Integer value) { if (value != null) { updateSampleCount(value); } } }); }
public static void register2Property(SentinelProperty<Integer> property) { property.addListener(new SimplePropertyListener<Integer>() { @Override public void configUpdate(Integer value) { if (value != null) { updateInterval(value); } } }); }
private static void bindPropertyListener() { removePropertyListener(); clientAssignProperty.addListener(ASSIGN_PROPERTY_LISTENER); clientConfigProperty.addListener(CONFIG_PROPERTY_LISTENER); }
/** * 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; } }
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; } }
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"); } }
/** * 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; } }
/** * 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"); } }
/** * Listen to the {@link SentinelProperty} for {@link DegradeRule}s. The property is the source * of {@link DegradeRule}s. Degrade rules can also be set by {@link #loadRules(List)} directly. * * @param property the property to listen. */ public static void register2Property(SentinelProperty<List<DegradeRule>> property) { synchronized (listener) { RecordLog.info("[DegradeRuleManager] Registering new property to degrade rule manager"); currentProperty.removeListener(listener); property.addListener(listener); currentProperty = property; } }
public static void registerServerAssignProperty(SentinelProperty<ClusterClientAssignConfig> property) { AssertUtil.notNull(property, "property cannot be null"); synchronized (ASSIGN_PROPERTY_LISTENER) { RecordLog.info("[ClusterClientConfigManager] Registering new server assignment property to cluster " + "client config manager"); clientAssignProperty.removeListener(ASSIGN_PROPERTY_LISTENER); property.addListener(ASSIGN_PROPERTY_LISTENER); clientAssignProperty = property; } }
public static void registerClientConfigProperty(SentinelProperty<ClusterClientConfig> property) { AssertUtil.notNull(property, "property cannot be null"); synchronized (CONFIG_PROPERTY_LISTENER) { RecordLog.info("[ClusterClientConfigManager] Registering new global client config property to " + "cluster client config manager"); clientConfigProperty.removeListener(CONFIG_PROPERTY_LISTENER); property.addListener(CONFIG_PROPERTY_LISTENER); clientConfigProperty = property; } }
private static void registerPropertyInternal(/*@NonNull*/ String namespace, /*@Valid*/ SentinelProperty<List<ParamFlowRule>> property) { NamespaceFlowProperty<ParamFlowRule> oldProperty = PROPERTY_MAP.get(namespace); if (oldProperty != null) { oldProperty.getProperty().removeListener(oldProperty.getListener()); } PropertyListener<List<ParamFlowRule>> listener = new ParamRulePropertyListener(namespace); property.addListener(listener); PROPERTY_MAP.put(namespace, new NamespaceFlowProperty<>(namespace, property, listener)); Set<Long> flowIdSet = NAMESPACE_FLOW_ID_MAP.get(namespace); if (flowIdSet == null) { resetNamespaceFlowIdMapFor(namespace); } }
/** * Register cluster server namespace set dynamic property. * * @param property server namespace set dynamic property */ public static void registerNamespaceSetProperty(SentinelProperty<Set<String>> property) { AssertUtil.notNull(property, "namespace set dynamic property cannot be null"); synchronized (NAMESPACE_SET_PROPERTY_LISTENER) { RecordLog.info( "[ClusterServerConfigManager] Registering new namespace set dynamic property to Sentinel server " + "config manager"); namespaceSetProperty.removeListener(NAMESPACE_SET_PROPERTY_LISTENER); property.addListener(NAMESPACE_SET_PROPERTY_LISTENER); namespaceSetProperty = property; } }
private static void registerPropertyInternal(/*@NonNull*/ String namespace, /*@Valid*/ SentinelProperty<List<FlowRule>> property) { NamespaceFlowProperty<FlowRule> oldProperty = PROPERTY_MAP.get(namespace); if (oldProperty != null) { oldProperty.getProperty().removeListener(oldProperty.getListener()); } PropertyListener<List<FlowRule>> listener = new FlowRulePropertyListener(namespace); property.addListener(listener); PROPERTY_MAP.put(namespace, new NamespaceFlowProperty<>(namespace, property, listener)); Set<Long> flowIdSet = NAMESPACE_FLOW_ID_MAP.get(namespace); if (flowIdSet == null) { resetNamespaceFlowIdMapFor(namespace); } }
/** * Register cluster server transport configuration dynamic property. * * @param property server transport configuration dynamic property */ public static void registerServerTransportProperty(SentinelProperty<ServerTransportConfig> property) { AssertUtil.notNull(property, "cluster server transport config dynamic property cannot be null"); synchronized (TRANSPORT_PROPERTY_LISTENER) { RecordLog.info( "[ClusterServerConfigManager] Registering new server transport dynamic property to Sentinel server " + "config manager"); transportConfigProperty.removeListener(TRANSPORT_PROPERTY_LISTENER); property.addListener(TRANSPORT_PROPERTY_LISTENER); transportConfigProperty = property; } }
private static void restorePropertyListeners() { for (NamespaceFlowProperty<ParamFlowRule> p : PROPERTY_MAP.values()) { p.getProperty().removeListener(p.getListener()); p.getProperty().addListener(p.getListener()); } }
/** * Register cluster server global statistic (flow) configuration dynamic property. * * @param property server flow configuration dynamic property */ public static void registerGlobalServerFlowProperty(SentinelProperty<ServerFlowConfig> property) { AssertUtil.notNull(property, "cluster server flow config dynamic property cannot be null"); synchronized (GLOBAL_FLOW_PROPERTY_LISTENER) { RecordLog.info( "[ClusterServerConfigManager] Registering new server global flow dynamic property " + "to Sentinel server config manager"); globalFlowProperty.removeListener(GLOBAL_FLOW_PROPERTY_LISTENER); property.addListener(GLOBAL_FLOW_PROPERTY_LISTENER); globalFlowProperty = property; } }
private static void restorePropertyListeners() { for (NamespaceFlowProperty<FlowRule> p : PROPERTY_MAP.values()) { p.getProperty().removeListener(p.getListener()); p.getProperty().addListener(p.getListener()); } }
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 registerNamespaceSetProperty(SentinelProperty<Set<String>> property) { synchronized (NAMESPACE_SET_PROPERTY_LISTENER) { RecordLog.info( "[ClusterServerConfigManager] Registering new namespace set dynamic property to Sentinel server " + "config manager"); namespaceSetProperty.removeListener(NAMESPACE_SET_PROPERTY_LISTENER); property.addListener(NAMESPACE_SET_PROPERTY_LISTENER); namespaceSetProperty = property; } }