Skip to content

Instantly share code, notes, and snippets.

@koic
Created June 1, 2010 07:00
Show Gist options
  • Save koic/420662 to your computer and use it in GitHub Desktop.
Save koic/420662 to your computer and use it in GitHub Desktop.
Example of interval task using java.util.Timer and java.util.TimerTask.
Timer timer = new Timer(true);
...
TimerTask task = new TimerTask() {
public void run() {
// The action to be performed by this timer task.
}
};
timer.scheduleAtFixedRate(task, 0, watchInterval);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment