Skip to content

Instantly share code, notes, and snippets.

@purplefox
Created July 2, 2015 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purplefox/aeb4794c519e62e397d2 to your computer and use it in GitHub Desktop.
Save purplefox/aeb4794c519e62e397d2 to your computer and use it in GitHub Desktop.
// In Vert.x 3:
public static void main(String[] args) {
Vertx.vertx().setPeriodic(1000, tid -> System.out.println("hello"));
}
//If the threads were daemon then they above would exit immediately so you'd have to do something like the following to prevent // main from exiting (or any other method that blocks the main thread)
public static void main(String[] args) {
Vertx.vertx().setPeriodic(1000, tid -> System.out.println("hello"));
try {
} catch (Exception ignore) {
Thread.sleep(1000000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment