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

com.jeesuite.filesystem.sdk.fdfs.TrackerSelector Maven / Gradle / Ivy

There is a newer version: 1.3.6
Show newest version
package com.jeesuite.filesystem.sdk.fdfs;

import java.util.List;
import java.util.Random;


public enum TrackerSelector {

    ROUND_ROBIN {
        private int idx;

        @Override
        public TrackerServer select(List list) {
            idx %= list.size();
            return list.get(idx++);
        }

    },
    RANDOM {
        private final Random random = new Random();

        @Override
        public TrackerServer select(List list) {
            return list.get(random.nextInt(list.size()));
        }

    },
    FIRST {
        @Override
        TrackerServer select(List list) {
            return list.get(0);
        }

    };

    abstract TrackerServer select(List list);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy