public class ThroughputControl
extends java.lang.Object
ThroughputControl throughput = new ThroughputControl(15, 1000); while (isConditionTrue()) { throughput.control(); // Do stuff. }
Constructor and Description |
---|
ThroughputControl(int[] maxTransactions,
int[] periodInMillis) |
ThroughputControl(int maxTransactions,
int periodInMillis) |
Modifier and Type | Method and Description |
---|---|
long |
control()
This method should be called on every transaction.
|
public ThroughputControl(int maxTransactions, int periodInMillis)
maxTransactions
- Transaction count threshold.periodInMillis
- Time window, expressed in milliseconds.public ThroughputControl(int[] maxTransactions, int[] periodInMillis)
maxTransactions
- An array with transaction count thresholds.periodInMillis
- An array of time windows, expressed in milliseconds.