Code example for ScheduledExecutorService

Methods: scheduleAtFixedRate

0
    private long timeStamp;
    private InEvent event = null;
 
    public PerSnapshotOutputRateManager(Long value, ScheduledExecutorService scheduledExecutorService, WrappedSnapshotOutputRateManager wrappedSnapshotOutputRateManager) {
        super(wrappedSnapshotOutputRateManager);
        scheduledExecutorService.scheduleAtFixedRate(new EventSender(), 0, value, TimeUnit.MILLISECONDS);
    } 
 
    @Override 
    public synchronized void send(long timeStamp, StreamEvent currentEvent, StreamEvent expiredEvent, String groupByKey) {
        this.timeStamp = timeStamp;
        if (currentEvent != null) {
            if (currentEvent instanceof ListEvent) {
                event = (InEvent) ((ListEvent) currentEvent).getEvent(((ListEvent) currentEvent).getActiveEvents());
            } else { 
                event = (InEvent) currentEvent;
            } 
        } 
    } 
 
    public synchronized void sendEvents() {