org.kaizen4j.common.algorithm.hash.WeightedShard Maven / Gradle / Ivy
package org.kaizen4j.common.algorithm.hash;
import com.google.common.base.Preconditions;
public class WeightedShard {
private T t;
private int weight;
public WeightedShard(T t, int weight) {
this.t = t;
this.weight = weight;
checkArguments();
}
private void checkArguments() {
Preconditions.checkArgument(weight > 0, "The argument 'weight' must be great than zero");
Preconditions.checkNotNull(t);
}
public T getServer() {
return t;
}
public int getWeight() {
return weight;
}
}