Package org.apache.ignite.util
Class AttributeNodeFilter
- java.lang.Object
-
- org.apache.ignite.util.AttributeNodeFilter
-
- All Implemented Interfaces:
Serializable,IgnitePredicate<ClusterNode>
public class AttributeNodeFilter extends Object implements IgnitePredicate<ClusterNode>
Implementation ofIgnitePredicate<ClusterNode>based onuser attributes. This filter can be used in methods likeClusterGroup.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
groupattribute set to valuedata:<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 bothcpu-groupandmemory-groupattributes set to valuehigh.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AttributeNodeFilter(String attrName, @Nullable Object attrVal)Creates new node filter with a single attribute value.AttributeNodeFilter(Map<String,Object> attrs)Creates new node filter with a set of attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanapply(ClusterNode node)Predicate body.Map<String,Object>getAttrs()Gets attributes.
-
-
-
Method Detail
-
apply
public boolean apply(ClusterNode node)
Predicate body.- Specified by:
applyin interfaceIgnitePredicate<ClusterNode>- Parameters:
node- Predicate parameter.- Returns:
- Return value.
-
-