Skip to content

Instantly share code, notes, and snippets.

@khan5v
Created March 12, 2018 09:31
Show Gist options
  • Save khan5v/b097d28b989b3d6441f1b79ba430bae2 to your computer and use it in GitHub Desktop.
Save khan5v/b097d28b989b3d6441f1b79ba430bae2 to your computer and use it in GitHub Desktop.
import java.util.*;
public class Scheduler {
public static void main(String[] args) {
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
final Runnable ticker = new Runnable() {
public void run() {
System.out.println("Ran");
}
};
// Schedule to run in a thread every <updateStep> milliseconds
scheduler.scheduleAtFixedRate(ticker, 0, updateStep, TimeUnit.MILLISECONDS);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment