Code example for ScheduledExecutorService

Methods: scheduleAtFixedRate

0
    static final Logger log = Logger.getLogger(FirstPerTimeOutputRateManager.class);
 
 
    public FirstPerTimeOutputRateManager(Long value, ScheduledExecutorService scheduledExecutorService) {
        this.value = value;
        scheduledExecutorService.scheduleAtFixedRate(new EventReSeter(), 0, value.longValue(), TimeUnit.MILLISECONDS);
    } 
 
    @Override 
    public synchronized void send(long timeStamp, StreamEvent currentEvent, StreamEvent expiredEvent, String groupByKey) {
 
        if (currentEvent != null) {
            if (currentEvent instanceof ListEvent) {
                for (int i = 0, size = ((ListEvent) currentEvent).getActiveEvents(); i < size; i++) {
                    if (firstEvent == null) {
                        firstEvent = ((ListEvent) currentEvent).getEvent(i);
                        sendToCallBacks(timeStamp, firstEvent, null, firstEvent);
                    } 
                } 
            } else { 
                if (firstEvent == null) {