If you want to do task every 250ms even doStuff() may take more than 250ms, you should use a new thread to “doStuff”(In this case, more than one doStuff may work at a time)
updated(I tried this in win7x64, JDK 1.6 and it works)
java.util.TimerTask task = new java.util.TimerTask() {
@Override
public void run() {
System.out.println("yoo");
}
};
java.util.Timer timer = new java.util.Timer();
timer.schedule(task, java.util.Calendar.getInstance().getTime(), 250);
2
solved How To Do Task Repeatedly In Java 1.6 [duplicate]