com.amazonaws.services.simpleworkflow.flow.worker
Class Throttler
java.lang.Object
com.amazonaws.services.simpleworkflow.flow.worker.Throttler
public class Throttler
- extends Object
Constructor Summary |
Throttler(String name,
double maxRatePerSecond,
long rateIntervalMilliseconds)
Construct throttler. |
Method Summary |
void |
setMaxRatePerSecond(double maxRatePerSecond)
|
void |
throttle()
When called on each request sleeps if called faster then configured average rate. |
void |
throttle(int count)
|
Throttler
public Throttler(String name,
double maxRatePerSecond,
long rateIntervalMilliseconds)
- Construct throttler.
- Parameters:
name
- Human readable name of the resource being throttled. Used for logging only.maxRatePerSecond
- maximum rate allowedrateIntervalMilliseconds
- rate measurement interval. Interval should be at least
1000 / maxRatePerSecond.
setMaxRatePerSecond
public void setMaxRatePerSecond(double maxRatePerSecond)
throttle
public void throttle(int count)
throws InterruptedException
- Throws:
InterruptedException
throttle
public void throttle()
throws InterruptedException
- When called on each request sleeps if called faster then configured average rate.
- Throws:
InterruptedException
- when interrupted
Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.