Class ScoringLoadBalancer.NodesScore
- java.lang.Object
-
- jp.ikedam.jenkins.plugins.scoringloadbalancer.ScoringLoadBalancer.NodesScore
-
- Enclosing class:
- ScoringLoadBalancer
public static class ScoringLoadBalancer.NodesScore extends Object
Holds scores of nodes. A node with a larger score is preferred to use.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ScoringLoadBalancer.NodesScore.ExecutorComparator
Comparator for sortingMappingWorksheet.ExecutorChunk
-
Constructor Summary
Constructors Constructor Description NodesScore(Collection<MappingWorksheet.ExecutorChunk> executors)
Constructor Initialize scores for each nodes to 0.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScore(Node node, int score)
Add score to the node.void
addScore(MappingWorksheet.ExecutorChunk executor, int score)
Add score to the node.Collection<MappingWorksheet.ExecutorChunk>
getExecutorChunks()
Get executors to score.Collection<Node>
getNodes()
Get nodes to score.int
getScore(Node node)
Get the score of the node.int
getScore(MappingWorksheet.ExecutorChunk executor)
Get the score of the node.boolean
isInvalid(Node node)
boolean
isInvalid(MappingWorksheet.ExecutorChunk executor)
Same to callisInvalid(Node)
for executor.node.void
markAllInvalid()
Mark all nodes invalid.void
markInvalid(Node node)
Make the task not run on this node.void
markInvalid(MappingWorksheet.ExecutorChunk executor)
Make the task not run on this node.void
resetInvalid()
Reset invalid marks on all nodes.void
resetScore(Node node)
Reset the score of the node to 0.void
resetScore(MappingWorksheet.ExecutorChunk executor)
Reset the score of the node to 0.
-
-
-
Constructor Detail
-
NodesScore
public NodesScore(Collection<MappingWorksheet.ExecutorChunk> executors)
Constructor Initialize scores for each nodes to 0.- Parameters:
executors
-
-
-
Method Detail
-
getNodes
public Collection<Node> getNodes()
Get nodes to score. same to retrieveMappingWorksheet.ExecutorChunk.node
forgetExecutorChunks()
- Returns:
- nodes to score.
-
getExecutorChunks
public Collection<MappingWorksheet.ExecutorChunk> getExecutorChunks()
Get executors to score.- Returns:
- executors to score.
-
addScore
public void addScore(Node node, int score)
Add score to the node.- Parameters:
node
-score
-
-
addScore
public void addScore(MappingWorksheet.ExecutorChunk executor, int score)
Add score to the node. Same to calladdScore(Node, int)
for executor.node- Parameters:
executor
-score
-
-
resetScore
public void resetScore(Node node)
Reset the score of the node to 0.- Parameters:
node
-
-
resetScore
public void resetScore(MappingWorksheet.ExecutorChunk executor)
Reset the score of the node to 0. Same to callresetScore(Node)
for executor.node- Parameters:
executor
-
-
getScore
public int getScore(Node node)
Get the score of the node.- Parameters:
node
-- Returns:
-
getScore
public int getScore(MappingWorksheet.ExecutorChunk executor)
Get the score of the node. Same to callgetScore(Node)
for executor.node.- Parameters:
executor
-- Returns:
-
markInvalid
public void markInvalid(MappingWorksheet.ExecutorChunk executor)
Make the task not run on this node. Same to callmarkInvalid(Node)
for executor.node.- Parameters:
executor
-
-
markInvalid
public void markInvalid(Node node)
Make the task not run on this node.- Parameters:
node
-
-
resetInvalid
public void resetInvalid()
Reset invalid marks on all nodes.
-
markAllInvalid
public void markAllInvalid()
Mark all nodes invalid.
-
isInvalid
public boolean isInvalid(MappingWorksheet.ExecutorChunk executor)
Same to callisInvalid(Node)
for executor.node.- Parameters:
executor
-- Returns:
-
isInvalid
public boolean isInvalid(Node node)
- Parameters:
node
-- Returns:
-
-