org.jpos.util
Class ThroughputControl
java.lang.Object
org.jpos.util.ThroughputControl
public class ThroughputControl
- extends java.lang.Object
ThroughputControl can be used to limit the throughput
of a system to a maximum number of transactions in
a given period of time.
|
Method Summary |
long |
control()
control should be called on every transaction. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThroughputControl
public ThroughputControl(int maxTransactions,
int periodInMillis)
- Parameters:
maxTransactions - dittoperiodInMillis - ditto
ThroughputControl
public ThroughputControl(int[] maxTransactions,
int[] periodInMillis)
- Parameters:
maxTransactions - dittoperiodInMillis - ditto
control
public long control()
- control should be called on every transaction.
it may sleep for a while in order to control the system throughput
- Returns:
- aprox sleep time or zero if no sleep