ScheduledThreadPoolExecutor running 15 milliseconds late only outside of IDE?
posted 3 years ago
Hi everyone I hope someone can help me with this problem. I've been creating countless test programs and researching non stop but can't seem to find an answer.
All I'm doing is creating a ScheduledThreadPoolExecutor and scheduling it at a fixed rate of 3 milliseconds. The problem is the rate at which it executes isn't consistent. It executes for awhile at 5 milliseconds and then jumps to random spikes of 15 - 20 milliseconds and just goes crazy trying to catch up.
The problem doesn't occur inside an IDE and only occurs outside the IDE running from the command line or from a Jar. Strange huh... I created a simple test case below that's easy to compile. If you want too see the problem make sure to run it outside of an IDE through the command line.