Guest User

Untitled

a guest
Jul 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. interface Throttle {
  2. boolean isOkToProcess();
  3. void processed();
  4. void processed(long when);
  5. }
  6.  
  7. class Processor {
  8. Throttle throttle = ThrottleFactory.defaultThrottle();
  9. DownstreamProcessor downstream;
  10. onEvent(Event ev) {
  11. if (throttle.isOkToProcess()) {
  12. downstream.process();
  13. throttle.processed();
  14. }
  15. }
Add Comment
Please, Sign In to add comment