Skip to content

Commit 8793f2d

Browse files
authored
Merge a897fa7 into 8d0202c
2 parents 8d0202c + a897fa7 commit 8793f2d

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/assign/LowerWeightRoundRobin.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
public class LowerWeightRoundRobin extends AbstractSelector<HostWeight> {
2626

2727
/**
28-
* select
28+
* Selects a HostWeight from a collection of HostWeight objects.
29+
* The selection is based on the current weight of each HostWeight.
30+
* The HostWeight with the smallest current weight is selected.
2931
*
30-
* @param sources sources
31-
* @return HostWeight
32+
* @param sources A collection of HostWeight objects to select from.
33+
* @return The selected HostWeight with the smallest current weight.
3234
*/
3335
@Override
3436
public HostWeight doSelect(Collection<HostWeight> sources) {

dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/assign/RandomSelector.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
*/
2828
public class RandomSelector extends AbstractSelector<HostWorker> {
2929

30+
/**
31+
* This method selects a HostWorker from a collection of HostWorker objects using a weighted random algorithm.
32+
* The selection is based on the weight of each HostWorker.
33+
* A random number is generated and the HostWorker whose weight spans this random number is selected.
34+
*
35+
* @param source A collection of HostWorker objects to select from.
36+
* @return The selected HostWorker based on the weighted random algorithm.
37+
*/
3038
@Override
3139
public HostWorker doSelect(final Collection<HostWorker> source) {
3240

dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/assign/RoundRobinSelector.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ void setLastUpdate(long lastUpdate) {
7373

7474
}
7575

76+
/**
77+
* This method selects a HostWorker from a collection of HostWorker objects using a weighted round-robin algorithm.
78+
* The selection is based on the current weight of each HostWorker.
79+
* The HostWorker with the highest current weight is selected.
80+
*
81+
* @param source A collection of HostWorker objects to select from.
82+
* @return The selected HostWorker with the highest current weight.
83+
*/
7684
@Override
7785
public HostWorker doSelect(Collection<HostWorker> source) {
7886

0 commit comments

Comments
 (0)