This is an automated email from the ASF dual-hosted git repository.
iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 63d33d1 [DUBBO-2991][WIP]Enhance the java doc of dubbo-cluster
(#2991) (#4424)
63d33d1 is described below
commit 63d33d1fbc1258f72b73e169eb90bd41ac0da44c
Author: Daniela Marques de Morais <[email protected]>
AuthorDate: Tue Jul 16 23:31:23 2019 -0300
[DUBBO-2991][WIP]Enhance the java doc of dubbo-cluster (#2991) (#4424)
* Replace RpcStatus to count (#2984)
* Create constants for 'hash.names' and 'hash.arguments' (#3744)
* Add javadoc in RandomLoadBalance
* Improve Javadoc of RandomLoadBalance
---
.../dubbo/rpc/cluster/loadbalance/RandomLoadBalance.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalance.java
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalance.java
index 88453ad..adfd04b 100644
---
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalance.java
+++
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/RandomLoadBalance.java
@@ -24,12 +24,25 @@ import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
- * random load balance.
+ * This class select one provider from multiple providers randomly.
+ * You can define weights for each provider:
+ * If the weights are all the same then it will use random.nextInt(number of
invokers).
+ * If the weights are different then it will use random.nextInt(w1 + w2 + ...
+ wn)
+ * Note that if the performance of the machine is better than others, you can
set a larger weight.
+ * If the performance is not so good, you can set a smaller weight.
*/
public class RandomLoadBalance extends AbstractLoadBalance {
public static final String NAME = "random";
+ /**
+ * Select one invoker between a list using a random criteria
+ * @param invokers List of possible invokers
+ * @param url URL
+ * @param invocation Invocation
+ * @param <T>
+ * @return The selected invoker
+ */
@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url,
Invocation invocation) {
// Number of invokers