Orkun
Orkun

Reputation: 7228

vertx : setTimer - can it fail?

We are using the setTimer to trigger a post proccess with a delay of 12seconds. On occasion, this seems to fail to fire.

Given that there is no interruption in the process - i.e no stop of the verticle, no a restart of the JVM or killing of the thread ... etc. - what would be the reasons for the setTimer to fail?

Doc on setTimer: https://vertx.io/docs/vertx-core/java/

Upvotes: 0

Views: 1134

Answers (1)

Alexey Soshin
Alexey Soshin

Reputation: 17701

That most probably is not the case.

Under the hood, Vert.x timer is a simple that is scheduled on the event loop: https://github.com/eclipse-vertx/vert.x/blob/master/src/main/java/io/vertx/core/impl/VertxImpl.java#L917

If that would be the case, other much more critical tasks would fail too, and you wouldn't be using Vert.x at all.

But since timer is a simple handler, that runs on the same thread it was set, it may get delayed by something that blocks the thread.

Upvotes: 1

Related Questions