threadly/threadly — pull request #92 by jentfoo (2014-06-06 02:05:17+00:00)
Title: Issue91 single thread scheduler shutdown now

There is a bit more included in this commit than I originally expected. This adds "shutdownNow" to the SingleThreadScheduler. But it also improves the logic for the normal "shutdown" call as well.

The key to adding this implementation is adding a call to interrupt the .tick() call in NoThreadScheduler (which is only a protected visible function).

Once I wrote unit tests for the SingleThreadScheduler, I added similar unit tests to the PriorityScheduledExecutor unit tests. This uncovered a couple other small defects/defencies in both the PriorityScheduledExecutor as well as the PrioritySchedulerStatisticTracker. So those improvements are also included in this pull request.

There is a lot in this, so I will comment the changes to indicate what is going on.