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.ClusterAttributeNodeFilter"> <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.ClusterAttributeNodeFilter"> <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,
Object attrVal)
Creates new node filter with a single attribute value.
|
public AttributeNodeFilter(String attrName, @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 Fabric : ver. 2.5.0 Release Date : May 23 2018