public class TargetRateInput extends Object implements Input, ActivityDefObserver, RateLimiterProvider, ProgressCapable
TODO: This documentation is out of date as of 2.0.0
This input will provide threadsafe access to a sequence of long values.
If the targetrate parameter is set on the activity def, then the rate of grants will also be throttled to that rate.
Changes to the cycles or the targetrate will affect the provided inputs. If the min or max cycle is changed, then these are re-applied first to the max cycle and then to the min cycle. If the min cycle is changed, then the next cycle value is set to the assigned min value. Otherwise, the cycle will continue as usual till it reaches the max value. The ability to reset the input while running by applying a new set of parameters makes it possible to re-trigger a sequence of inputs during a test.
This input, and Inputs in general do not actively prevent usage of values after the max value. They simply expose it to callers. It is up to the caller to check the value to determine when the input is deemed "used up."
| Constructor and Description |
|---|
TargetRateInput(ActivityDef activityDef) |
| Modifier and Type | Method and Description |
|---|---|
CycleSegment |
getInputSegment(int stride)
Return the next InputSegment available, or null if
none were available.
|
double |
getProgress() |
com.google.common.util.concurrent.RateLimiter |
getRateLimiter() |
double |
getTotal() |
boolean |
isContiguous() |
void |
onActivityDefUpdate(ActivityDef activityDef) |
String |
toString() |
public TargetRateInput(ActivityDef activityDef)
public CycleSegment getInputSegment(int stride)
InputAll implementations of this method are required to be thread-safe.
getInputSegment in interface Inputstride - The number of cycles (not necessarily contiguous) in the segment.public double getProgress()
getProgress in interface ProgressCapablepublic double getTotal()
getTotal in interface ProgressCapablepublic void onActivityDefUpdate(ActivityDef activityDef)
onActivityDefUpdate in interface ActivityDefObserverpublic com.google.common.util.concurrent.RateLimiter getRateLimiter()
getRateLimiter in interface RateLimiterProviderpublic boolean isContiguous()
isContiguous in interface InputCopyright © 2017. All rights reserved.