Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Throttle {
- boolean isOkToProcess();
- void processed();
- void processed(long when);
- }
- class Processor {
- Throttle throttle = ThrottleFactory.defaultThrottle();
- DownstreamProcessor downstream;
- onEvent(Event ev) {
- if (throttle.isOkToProcess()) {
- downstream.process();
- throttle.processed();
- }
- }
Add Comment
Please, Sign In to add comment