Module com.github.akurilov.commons
Class SequentialWeightsThrottle
- java.lang.Object
-
- com.github.akurilov.commons.concurrent.throttle.SequentialWeightsThrottle
-
- All Implemented Interfaces:
IndexThrottle
public final class SequentialWeightsThrottle extends java.lang.Object implements IndexThrottle
Created by kurila on 29.03.16. An throttle which uses the map of weights. The throttle determines the weight for each I/O task and makes the decision. The weight is used to pass the I/O task with specific ratio for the different keys.
-
-
Constructor Summary
Constructors Constructor Description SequentialWeightsThrottle(int[] weights)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleantryAcquire(int index)inttryAcquire(int index, int times)
-
-
-
Method Detail
-
tryAcquire
public final boolean tryAcquire(int index)
- Specified by:
tryAcquirein interfaceIndexThrottle
-
tryAcquire
public final int tryAcquire(int index, int times)- Specified by:
tryAcquirein interfaceIndexThrottle
-
-