/** * Adds the given <code>event</code> to this report. If this report is too full, * the event will be silently rejected (i.e. an exception will not be thrown, but the * event will not be sent to the server). * * @param event the {@link Event} to be added * @param eventSource the source of the Event to be added */ public void addEvent(@NotNull Event event, @NotNull EventSource eventSource) { if (this.totalEventsInReport < this.maxEventsPerReport) { Set<Event> eventSet = getEventsForEventSource(eventSource); if (eventSet.size() < this.maxEventsPerSource) { eventSet.add(event); this.totalEventsInReport++; } else { // this event source has maxed out its allowed number of events for this report droppedEvent(eventSource); } } else { // this event report has maxed out its total allowed number of events. droppedEvent(eventSource); } return; }