Vert.x - Timer/Periodic

Documentation

Vert.x has two types of timers:

Type

One shot

One shot after 3 seconds:

long timerID = vertx.setTimer(3000, new Handler<Long>() {
    @Override
    public void handle(Long aLong) {
        System.out.println("One Shot Timer fired");
    }
});

Periodic

Periodic every 3 seconds

long timerID = vertx.setPeriodic(3000, new Handler<Long>() {

    @Override
    public void handle(Long aLong) {
        System.out.println("Periodic Timer fired: " + aLong);
    }
});

Powered by ComboStrap