Class PowerOfKRoutingStrategy
java.lang.Object
NetStrategies.RoutingStrategy
NetStrategies.RoutingStrategies.PropertyBasedStrategy
NetStrategies.RoutingStrategies.PowerOfKRoutingStrategy
- All Implemented Interfaces:
AutoCheck
This strategy picks, at random, k resources and sends jobs to the resource with the shortest queue.
- Author:
- Vaibhav Krishnakumar, Bertoli Marco
-
Constructor Summary
ConstructorsConstructorDescriptionPowerOfKRoutingStrategy(Integer k, Boolean withMemory) Creates a Power of K Routing Strategy with the passed parameter k. -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecalculateProperty(NetNode node, JobClass jobClass) getOutNode(NetNode ownerNode, JobClass jobClass) This strategy selects the resource with the shortest queue among k output nodes selected at random.Methods inherited from class PropertyBasedStrategy
calculateQueueLength, getRandomIndexBelowMethods inherited from class RoutingStrategy
check, getOutNode, getOutNode
-
Constructor Details
-
PowerOfKRoutingStrategy
-
-
Method Details
-
getOutNode
This strategy selects the resource with the shortest queue among k output nodes selected at random.- Overrides:
getOutNodein classPropertyBasedStrategy- Parameters:
ownerNode- Owner node of the output section.jobClass- class of current job to be routed- Returns:
- Selected node.
-
calculateProperty
- Specified by:
calculatePropertyin classPropertyBasedStrategy- Throws:
NetException
-