Note that there are some explanatory texts on larger screens.

plurals
  1. POJava scheduler which is completely independent of system time changes
    primarykey
    data
    text
    <p>Was using Java Timer, Then switched to ScheduledExecutorService, but my problem is not fixed. As Tasks scheduled before system time change (through ntpd) are not executed on delay specified. Have no logs for same as nothing happens :(.</p> <p>using jre 1.6.0_26 64 bit in my target on 64 bit linux.</p> <blockquote> <p><strong>Update:</strong> ScheduledExecutorService works fine on Windows. Problem is only on 64 bit Linux based system running 64 bit JVM. It works fine on 64 bit linux running 32 bit JVM...strange. Have not found any reference of same on any blogs either.</p> <p>IBM's JAVA SDK has same problem (ibm-java-sdk-7.0-0.0-x86_64-archive.bin).</p> <p><strong>I had filed defect against JDK <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7139684">7139684</a>,It was accepted but has been closed and marked duplicate of <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6900441">6900441</a>. Please vote for it , if you feel its worth to get it fixed... I have no idea why its not been fixed since more than couple of years</strong></p> </blockquote> <p>Here is sample code I used to test this issue:</p> <pre><code>package test; import java.io.IOException; import java.util.Date; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** * @author yogesh * */ public class TimerCheck implements Runnable { ScheduledExecutorService worker; public TimerCheck(ScheduledExecutorService worker) { super(); this.worker = worker; this.worker.schedule(this, 1, TimeUnit.SECONDS); } private static void update() { System.out.println("TimerCheck.update() "+new Date(System.currentTimeMillis())); } @Override public void run() { update(); worker.schedule(this, 1, TimeUnit.SECONDS); } /** * @param args */ public static void main(String[] args) { ScheduledExecutorService worker = Executors.newScheduledThreadPool(1); new TimerCheck(worker); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload