EVALUATION
As the submitter had determined the various "schedule" methods contain code of the form:
long triggerTime = now() + delay;
and if the delay is sufficiently large then overflow will occur.
When overflow occurs a negative delay-time can be stored into the delay-queue and this causes the delay queue to operate incorrectly. If you place a correct entry in the queue and then add a negative entry, while the correct entry is still there, then the correct entry is pushed down and no task ever becomes scheduled to run - and we have the hang as reported.
However, if the correct task is removed from the queue by a worker thread, prior to the negative task being submitted, then the task is correctly replaced in the queue and the test passes.
It was curious to find that:
java Test
passes, while
java -showversion Test
always hangs.
|