@Override
        public synchronized void run() {
            if (stop) {
                return;
            }
            SiddhiAppContext.startPartitionFlow(key);
            try {
                if (!siddhiQueryContext.getSiddhiAppContext().isPlayback()) {
                    sendTimerEvents(state);

                    Long toNotifyTime = state.toNotifyQueue.peek();
                    long currentTime = siddhiQueryContext.getSiddhiAppContext().getTimestampGenerator().currentTime();

                    if (toNotifyTime != null) {
                        state.scheduledFuture = scheduledExecutorService.
                                schedule(this, toNotifyTime - currentTime, TimeUnit.MILLISECONDS);
                    } else {
                        try {
                            mutex.acquire();
                            state.running = false;
                            if (state.toNotifyQueue.peek() != null) {
                                state.running = true;
                                state.scheduledFuture = scheduledExecutorService.schedule(this,
                                        0, TimeUnit.MILLISECONDS);
                            }
                        } catch (InterruptedException e) {
                            Thread.currentThread().interrupt();
                            log.error("Error when scheduling System Time Based Scheduler", e);
                        } finally {
                            mutex.release();
                        }
                    }
                } else {
                    state.running = false;
                }
            } catch (Throwable t) {
                log.error("Error while executing Scheduled Timer Event Caller, " + t.getMessage(), t);
            } finally {
                SiddhiAppContext.stopPartitionFlow();
            }
        }
When an object implementing interface <code>Runnable</code> is used
to create a thread, starting the thread causes the object's
<code>run</code> method to be called in that separately executing
thread.
<p>
The general contract of the method <code>run</code> is that it may
take any action whatsoever.

@see Thread#run()
modules/siddhi-core/src/main/java/io/siddhi/core/util/Scheduler.java