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

com.redismq.common.rebalance.RandomBalance Maven / Gradle / Ivy

There is a newer version: 0.4.2
Show newest version
package com.redismq.common.rebalance;

import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

/**
 * 随机
 *
 * @author hzh
 * @date 2024/05/05
 */
public class RandomBalance implements ServerSelectBalance {
    
    @Override
    public  T select(List invokers, String id) {
        int length = invokers.size();
        return invokers.get(ThreadLocalRandom.current().nextInt(length));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy