Add documentation. Add options to enable/disable the hash providers. Add the option for setup barrier for rotation per requests strategy.

This commit is contained in:
Anatoly Sablin
2019-12-02 23:23:17 +03:00
parent 51d9225dda
commit 7509174611
8 changed files with 120 additions and 5 deletions

View File

@@ -8,6 +8,11 @@ public class RotationPerRequests implements HashRotationStrategy {
private HashEngine hashEngine;
private final AtomicInteger counter = new AtomicInteger(0);
private final int barrier;
public RotationPerRequests(int barrier) {
this.barrier = barrier;
}
@Override
public void register(HashEngine hashEngine) {
@@ -23,7 +28,7 @@ public class RotationPerRequests implements HashRotationStrategy {
@Override
public synchronized void newRequest() {
int newValue = counter.incrementAndGet();
if (newValue >= 10) {
if (newValue >= barrier) {
counter.set(0);
trigger();
}