I'm not sure about optimization in Scheduler chapter with PriorityBlockingQueue. The problem is that the tasks with priority will be put into the queue at the right positions. And this costs performance. This is like putting data into a tree data structure with binary search algorithm. Instead of that I would introduce 3 queues without priority and put tasks into the proper queue dependent on the task's priority. A separate consumer thread should read (poll) all 3 queues in a right order (from high important to less important). That's e.g. how I did it in my real-time project.