Package org.jppf.node.policy
Class NodesMatching
java.lang.Object
org.jppf.node.policy.ExecutionPolicy
org.jppf.node.policy.NodesMatching
- All Implemented Interfaces:
Serializable
An execution policy rule that checks whether a specified number of nodes match a node execution policy.
The number of nodes is expressed as a condtion of type actualNbNodes comp expectedNbNodes, where comp
is a
comparison operator among ==, !=, <, >, <=, >=.
Instances of this class can only apply to, and be used in, a server.
As an example, the condition "if there are more than 4 nodes idle and with at least 2 processors" can be expressed as follows:
ExecutionPolicy nodePolicy = new Equal("jppf.node.idle", true).and(new AtLeast("availableProcessors", 2));
ExecutionPolicy globalPolicy = new NodesMatching(Operator.GREATER, 4, nodePolicy);
Alternatively, it can also be written as an XML document:
<NodesMatching operator="GREATER" expected="4">
<AND>
<Equal valueType="boolean">
<Property>jppf.node.idle</Property>
<Value>true</Value>
</Equal>
<AtLeast>
<Property>availableProcessors</Property>
<Value>2</Value>
</AtLeast>
</AND>
</NodesMatching>
- Since:
- 5.2
- Author:
- Laurent Cohen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jppf.node.policy.ExecutionPolicy
ExecutionPolicy.AndRule, ExecutionPolicy.NotRule, ExecutionPolicy.OrRule, ExecutionPolicy.XorRule -
Field Summary
FieldsFields inherited from class org.jppf.node.policy.ExecutionPolicy
children -
Constructor Summary
ConstructorsConstructorDescriptionNodesMatching(Operator operator, long expectedNodes, ExecutionPolicy nodePolicy) Initialize this execution policy.NodesMatching(Operator operator, String expectedNodes, ExecutionPolicy nodePolicy) Initialize this execution policy. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(PropertiesCollection<String> info) Determines whether this policy accepts the specified node.toString(int n) Get an xml string representation of this policy with the specified starting indentation level.Methods inherited from class org.jppf.node.policy.ExecutionPolicy
and, and, andNot, andNot, checkRules, evaluate, getChildren, getContext, getProperty, indent, negate, not, Not, or, or, orNot, orNot, setContext, setContext, tagEnd, tagStart, toString, toXML, xmlElement, xmlElement, xor, xor
-
Field Details
-
XML_TAG
Name of the corresponding XML element.
-
-
Constructor Details
-
NodesMatching
Initialize this execution policy.- Parameters:
operator- the comparison operator to use for the number of nodes.expectedNodes- the expected number of nodes to use in the comparison.nodePolicy- the execution policy to match the nodes against. Ifnull, then all the nodes will match.
-
NodesMatching
Initialize this execution policy.- Parameters:
operator- the comparison operator to use for the number of nodes.expectedNodes- an expression that evaluates to the number of expected nodes.nodePolicy- the execution policy to match the nodes against. Ifnull, then all the nodes will match.
-
-
Method Details
-
accepts
Description copied from class:ExecutionPolicyDetermines whether this policy accepts the specified node. This method must be overriden in subclasses.- Specified by:
acceptsin classExecutionPolicy- Parameters:
info- system information for the node on which the tasks will run if accepted.- Returns:
- true if the node is accepted, false otherwise.
-
toString
Description copied from class:ExecutionPolicyGet an xml string representation of this policy with the specified starting indentation level.- Specified by:
toStringin classExecutionPolicy- Parameters:
n- the size of the indent to startwith.- Returns:
- an indented string depending on the value of
toStringIndent.
-