public void pushTask(Runnable task) {
        synchronized (tasks) {
            if (shutdown) {
                throw new RejectedExecutionException("Tasks can't be scheduled since queue has been shut down.");
            }

            tasks.add(new Entry(task, 0, sequenceCounter++));
            tasks.notifyAll();
        }
    }
Simple, lightweight event scheduler that does not maintain any executor
threads of its own, but rather makes it the responsibility of the caller
to run the events as the queue hands them over.

Fully thread safe for multiple readers and writers.
documentapi/src/main/java/com/yahoo/documentapi/messagebus/ScheduledEventQueue.java