context.getExecutionManager().register() blocking due to request timeouts

Hello,

I am trying to register timed threads that are non blocking. I was previously using the context.getExecutionManager().register() call to registers my workers, however this was causing thread starvation as advertised in the javadoc.

Is there an equivalent method that is recommended for use in a thread that could be blocking?

My threads are constantly performing REST calls. I need to ensure that the threads wont cause starvation if one thread is hung up on a request timeout.

There’s nothing wrong with creating an ExecutorService that your module uses exclusively to run these blocking REST calls on. You don’t need to use the platform ExecutionManager.

Create it with a fixed size if you’re worried about how many can be outstanding at any given time. Provide a ThreadFactory when you create the service so the threads can be identified as belonging to your module.

2 Likes

You can also create a Java HTTPClient with its own dedicated thread pool and do your own async calls from that (probably best as a singleton) instance.

1 Like

I will try this out, I think it makes sense for my module. Thank you!