Setting Affinity Conditions Programmatically

Create Property Affinity Conditions with the SchedulingConditionFactory, using the createPropertyAffinity method.

The following example in Java code creates a SchedulingConditionFactory, which is then used to create a Property Affinity Condition that would add four to the affinity of any Engine-Service pairing where the Engine has two CPUs:

SchedulingConditionFactory schedFactory =
     SchedulingConditionFactory.getInstance();
Condition dualAffinity =
     schedFactory.createPropertyAffinity(EngineProperties.CPU_NO,
     SchedulingConditionFactory.EQUALS, "2", 4.0);