Package nl.tue.id.oocsi.client.protocol

# Class RateLimitedEventHandler

java.lang.Object
nl.tue.id.oocsi.client.protocol.Handler
nl.tue.id.oocsi.client.protocol.EventHandler
nl.tue.id.oocsi.client.protocol.RateLimitedEventHandler

Direct Known Subclasses:
  `RateLimitedClientEventHandler`

    public abstract class RateLimitedEventHandler
    extends EventHandler

rate limited event handler for events with structured data that will only let through "rate" events per "second" secs; this counts for all incoming events

Author:
  matsfunk

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `protected int` | `rate` |
  `protected int` | `seconds` |
  `protected long` | `timestamp` |

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `RateLimitedEventHandler​(int rate, int seconds)` | creates a rate limited event handler that will at most let through "rate" event per "second" secs

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `exceeded​(java.lang.String sender, java.util.Map<java.lang.String,​java.lang.Object> data, long timestamp, java.lang.String channel, java.lang.String recipient)` |
  `protected void` | `internalReceive​(java.lang.String sender, java.util.Map<java.lang.String,​java.lang.Object> data, long timestamp, java.lang.String channel, java.lang.String recipient)` | internal hook to the super class method
  `void` | `limit​(int rate, int seconds)` | reconfigure the rate limitation to different "rate" and "seconds" timeframe
  `void` | `receive​(java.lang.String sender, java.util.Map<java.lang.String,​java.lang.Object> data, long timestamp, java.lang.String channel, java.lang.String recipient)` | abstract method to be implemented in anonymous classes that are instantiated by subscribing and registering for events

  ### Methods inherited from class nl.tue.id.oocsi.client.protocol.EventHandler

  `receive`

  ### Methods inherited from class nl.tue.id.oocsi.client.protocol.Handler

  `parseData, parseTimestamp, send`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### rate

    protected int rate

  - ### seconds

    protected int seconds

  - ### timestamp

    protected long timestamp

- ## Constructor Details

  - ### RateLimitedEventHandler

    public RateLimitedEventHandler​(int rate, int seconds)
    creates a rate limited event handler that will at most let through "rate" event per "second" secs
    Parameters:
      `rate` -
      `seconds` -

- ## Method Details

  - ### receive

    public void receive​(java.lang.String sender, java.util.Map<java.lang.String,​java.lang.Object> data, long timestamp, java.lang.String channel, java.lang.String recipient)
    Description copied from class: `Handler`
    abstract method to be implemented in anonymous classes that are instantiated by subscribing and registering for events
    Overrides:
      `receive` in class `EventHandler`

  - ### internalReceive

    protected final void internalReceive​(java.lang.String sender, java.util.Map<java.lang.String,​java.lang.Object> data, long timestamp, java.lang.String channel, java.lang.String recipient)
    internal hook to the super class method
    Parameters:
      `sender` -
      `data` -
      `timestamp` -
      `channel` -
      `recipient` -

  - ### exceeded

    public void exceeded​(java.lang.String sender, java.util.Map<java.lang.String,​java.lang.Object> data, long timestamp, java.lang.String channel, java.lang.String recipient)

  - ### limit

    public void limit​(int rate, int seconds)
    reconfigure the rate limitation to different "rate" and "seconds" timeframe
    Parameters:
      `rate` -
      `seconds` -