Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.event; |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 18 | import org.onlab.util.AbstractAccumulator; |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 19 | |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 20 | import java.util.Timer; |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Base implementation of an event accumulator. It allows triggering based on |
| 24 | * event inter-arrival time threshold, maximum batch life threshold and maximum |
| 25 | * batch size. |
| 26 | */ |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 27 | public abstract class AbstractEventAccumulator |
| 28 | extends AbstractAccumulator<Event> |
| 29 | implements EventAccumulator { |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
| 32 | * Creates an event accumulator capable of triggering on the specified |
| 33 | * thresholds. |
| 34 | * |
| 35 | * @param timer timer to use for scheduling check-points |
| 36 | * @param maxEvents maximum number of events to accumulate before |
| 37 | * processing is triggered |
| 38 | * @param maxBatchMillis maximum number of millis allowed since the first |
| 39 | * event before processing is triggered |
| 40 | * @param maxIdleMillis maximum number millis between events before |
| 41 | * processing is triggered |
| 42 | */ |
| 43 | protected AbstractEventAccumulator(Timer timer, int maxEvents, |
| 44 | int maxBatchMillis, int maxIdleMillis) { |
Brian O'Connor | cff0332 | 2015-02-03 15:28:59 -0800 | [diff] [blame] | 45 | super(timer, maxEvents, maxBatchMillis, maxIdleMillis); |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 46 | } |
| 47 | } |