java - Why does ScheduledExecutorService not expose methods to run at a particular time -
if want schedule @ recurring task aligned specific date make sense use scheduledexecutorservice
. has no method pass in firstrundate + subsequent delay scheduleatfixedrate
method. know can out initial delay myself there reason isn't provided api? internally ses implemented using triggertimes (which want pass in).
based on documentation:
all schedule methods accept relative delays , periods arguments, not absolute times or dates. simple matter transform absolute time represented date required form. example, schedule @ future date, can use: schedule(task, date.gettime() - system.currenttimemillis(), timeunit.milliseconds). beware expiration of relative delay need not coincide current date @ task enabled due network time synchronization protocols, clock drift, or other factors.
it looks if deseign decision. known date class has problems. example timetask's public void scheduleatfixedrate(timertask task, date firsttime, long period)
not account day light savings time.
Comments
Post a Comment