TRUNK-4212: Fix race conditions that were causing this test to fail on systems under heavy CPU load.

Speed up the test by using CountDownLatch instead of arbitrary
Thread.sleep() delays.

Fix database unique identifier issues by removing hardcoded ids and saving
tasks before scheduling to generate unique IDs.
Merge pull request #911 from anotherdave/TRUNK-4212

TRUNK-4212 SchedulerServiceTest fails depending on thread scheduling