ScheduledExecutorService subject to time drift?
I am using a ScheduledExecutorService to run a handful of scheduled tasks in a j2ee app and so far the experience hasn't been pleasant. One of the problems I am currently seeing is that the scheduler seems to randomly time drift for no expected reason and start running my tasks at a different time, usually just a second or two off.
So, basically what I do is start up my application and initialize the ScheduledExecutorService just once, typically placing 4-6 tasks on the scheduler running anywhere from once a minute to once a day. I don't mess with the service after that, it's just expected to run using that same configuration for the fully lifecycle of the application. And from some testing over night I found that if I started up 4 tasks all running once per minute that everything seemed to be working properly, until about 12 hours later. Here's some debugging output ...
DEBUG 2007-07-24 05:54:00,000 RollerTaskWithLeasing:run - Attempting to acquire
lease
DEBUG 2007-07-24 05:54:00,001 RollerTaskWithLeasing:run - Attempting to acquire
lease
DEBUG 2007-07-24 05:54:00,001 RollerTaskWithLeasing:run - Attempting to acquire
lease
DEBUG 2007-07-24 05:54:00,004 RollerTaskWithLeasing:run - Attempting to acquire
lease
DEBUG 2007-07-24 05:54:58,600 RollerTaskWithLeasing:run - Attempting to acquire
lease
DEBUG 2007-07-24 05:54:58,600 RollerTaskWithLeasing:run - Attempting to acquire
lease
DEBUG 2007-07-24 05:54:58,600 RollerTaskWithLeasing:run - Attempting to acquire
lease
DEBUG 2007-07-24 05:54:58,600 RollerTaskWithLeasing:run - Attempting to acquire
lease
I have logs showing that once a minute for over 12 hours the tasks ran effectively at the start of the minute as they were scheduled originally, but for some mysterious reason at 5:54 in the morning the scheduler bumped the tasks up by 1.4 seconds and started running them at a new time.
I realize that the javadoc says "Beware however that expiration of a relative delay need not coincide with the current Date at which the task is enabled due to network time synchronization protocols, clock drift, or other factors." and "Delayed tasks execute no sooner than they are enabled, but without any real-time guarantees about when, after they are enabled, they will commence." but does that effectively mean that there is literally no guarantee about when a scheduled task will run?
I wouldn't say that my application has any real-time needs, but I do expect some level of consistency and resiliency so that my scheduler doesn't get out of whack like it did. Is this just a bug in the ScheduledExecutorService? Is there an alternative way of doing these task schedulings?
I've tried using a TimerTask in the past, but that doesn't work for my application because some of the tasks can be lengthy.

