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

com.alibaba.schedulerx.worker.route.RoundRobinRouter Maven / Gradle / Ivy

There is a newer version: 1.12.2
Show newest version
package com.alibaba.schedulerx.worker.route;

import java.util.List;
import java.util.Map;

/**
 * @author dingxuan
 */
public class RoundRobinRouter extends Router {
    @Override
    public void init(String strategyContent) {
    }

    @Override
    public String route(long appGroupId, long jobId, List workerList, Map> targetWorkerAddsMap, long loopCount, String masterWorkerIdAddr) {
        int size = workerList.size();
        int index = 0;
        if (size == 0) {
            return null;
        } else if (loopCount >= size) {
            index = new Long(loopCount % size).intValue();
        }
        return workerList.get(index);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy