Scheduler queue replaced by a blocking queue

Scheduler queue replaced by a blocking queue to make testing with background threads easier. Also applicable to 2.0