All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.linshenkx.rpcnettycommon.route.impl.RandomRouteStrategyImpl Maven / Gradle / Ivy

package com.github.linshenkx.rpcnettycommon.route.impl;

import com.github.linshenkx.rpcnettycommon.route.RouteStrategy;
import org.apache.commons.lang3.RandomUtils;

import java.util.List;


/**
 * @version V1.0
 * @author: lin_shen
 * @date: 18-11-14
 * @Description: 随机策略 负载均衡
 */
public class RandomRouteStrategyImpl implements RouteStrategy  {

    @Override
    public  T select(List primeList) {
        return primeList.get(RandomUtils.nextInt(0, primeList.size()));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy