public class AttributeNodeFilter extends Object implements IgnitePredicate<ClusterNode>
IgnitePredicate<ClusterNode> based on
user attributes.
This filter can be used in methods like ClusterGroup.forPredicate(IgnitePredicate),
CacheConfiguration.setNodeFilter(IgnitePredicate),
ServiceConfiguration.setNodeFilter(IgnitePredicate), etc.
The filter will evaluate to true if a node has all provided attributes set to
corresponding values. Here is an example of how you can configure node filter for a
cache or a service so that it's deployed only on nodes that have group
attribute set to value data:
<property name="nodeFilter">
<bean class="org.apache.ignite.util.AttributeNodeFilter">
<constructor-arg value="group"/>
<constructor-arg value="data"/>
</bean>
</property>
You can also specify multiple attributes for the filter:
<property name="nodeFilter">
<bean class="org.apache.ignite.util.AttributeNodeFilter">
<constructor-arg>
<map>
<entry key="cpu-group" value="high"/>
<entry key="memory-group" value="high"/>
</map>
</constructor-arg>
</bean>
</property>
With this configuration a cache or a service will deploy only on nodes that have both
cpu-group and memory-group attributes set to value high.| Constructor and Description |
|---|
AttributeNodeFilter(Map<String,Object> attrs)
Creates new node filter with a set of attributes.
|
AttributeNodeFilter(String attrName,
@Nullable Object attrVal)
Creates new node filter with a single attribute value.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(ClusterNode node)
Predicate body.
|
Map<String,Object> |
getAttrs()
Gets attributes.
|
public AttributeNodeFilter(String attrName, @Nullable @Nullable Object attrVal)
attrName - Attribute name.attrVal - Attribute value.public boolean apply(ClusterNode node)
apply in interface IgnitePredicate<ClusterNode>node - Predicate parameter.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023