Hohenheimsenberg
Hohenheimsenberg

Reputation: 980

Set timeout on Vertx ExecuteBlocking

I have some code running on vertx.executeBlocking(), but sometimes it hangs trying to get an external connection without throwing any exception, the library I'm using is out of my control so I can't modify it to fail.

I only get a warning, but the thread keeps going on

WARNING: Thread Thread[vert.x-worker-thread-3,5,main]=Thread[vert.x-worker-thread-3,5,main] has been blocked for 177868 ms, time limit is 60000 ms

How can I tell vertx to timeout this call?

Upvotes: 2

Views: 2177

Answers (1)

Pendula
Pendula

Reputation: 780

Vertx does not expose API to control execution of Tasks via internal Executor service that gets called when you use vertx.executeBlocking()

What you can do is use your own Executor pool which is recommended for long tasks. An implementation with timeout is described in this ANSWER.

Upvotes: 1

Related Questions