Reputation: 117
I'm trying to create an architecture using Java Spring which will have several background processes which will be running concurrently, listening and pulling information as it arrives from different ZMQ sockets.
I'm not sure the best way to do this. Right now, i'm using the @Async annotation with a TaskPoolExecutor, but the @Async function seems to be blocking the next function call in the stack.
So my questions are 1) Will an @Async function block the next function call in the stack? Or will it fire off that function in a new thread, and continue executing the functions in the current thread. 2) Is there any way to give each Thread an equal timeslice of computing power. 3) Are there any better ways to do this?
Thanks!
Upvotes: 0
Views: 33
Reputation: 4410
CompletableFuture
API for asynchronous computations. I've
recently wrote a blog post about the problems with @Async
and how
they can be solved with CompletableFuture
: Demystifying the Magic
of Spring: @Async .Upvotes: 1