提交 | 用户 | 时间
|
722af2
|
1 |
package com.xxl.job.admin.core.route.strategy; |
X |
2 |
|
|
3 |
import com.xxl.job.admin.core.route.ExecutorRouter; |
|
4 |
import com.xxl.job.core.biz.model.ReturnT; |
|
5 |
import com.xxl.job.core.biz.model.TriggerParam; |
|
6 |
|
|
7 |
import java.util.List; |
|
8 |
import java.util.Random; |
|
9 |
|
|
10 |
/** |
|
11 |
* Created by xuxueli on 17/3/10. |
|
12 |
*/ |
|
13 |
public class ExecutorRouteRandom extends ExecutorRouter { |
|
14 |
|
|
15 |
private static Random localRandom = new Random(); |
|
16 |
|
|
17 |
@Override |
|
18 |
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) { |
|
19 |
String address = addressList.get(localRandom.nextInt(addressList.size())); |
|
20 |
return new ReturnT<String>(address); |
|
21 |
} |
|
22 |
|
|
23 |
} |