Test Package;
/ **
* by miaoXiaoQiang code
* /
Import java.util.concurrent.Executors;
Import java.util.concurrent.ScheduledExecutorService;
Import java.util.concurrent.TimeUnit;
public class TimingTest {
public static void main (String [ ] args) {
// the Java Interface java.util.concurrent.ScheduledExecutorService
the ScheduledExecutorService Executors.newSingleThreadScheduledExecutor ExecutorService = ();
// a fixed frequency multithreaded (fixedRate fixed frequency)
// this thread every 1000 milliseconds It has been executed down
executorService.scheduleAtFixedRate (new new Runnable () {
@Override
public void RUN () {
System.out.println("run : " + System.currentTimeMillis());
}
}, 0, 1000, TimeUnit.MILLISECONDS);
}
}
/ **
* by miaoXiaoQiang code
* /
Import java.util.concurrent.Executors;
Import java.util.concurrent.ScheduledExecutorService;
Import java.util.concurrent.TimeUnit;
public class TimingTest {
public static void main (String [ ] args) {
// the Java Interface java.util.concurrent.ScheduledExecutorService
the ScheduledExecutorService Executors.newSingleThreadScheduledExecutor ExecutorService = ();
// a fixed frequency multithreaded (fixedRate fixed frequency)
// this thread every 1000 milliseconds It has been executed down
executorService.scheduleAtFixedRate (new new Runnable () {
@Override
public void RUN () {
System.out.println("run : " + System.currentTimeMillis());
}
}, 0, 1000, TimeUnit.MILLISECONDS);
}
}