0

I am planning to implement an Event Driven system, based on the Actor model using CompletableFutures and individual Thread Pools for each actor.

However my tasks are completely sequential in nature and some of them are Network IO Bound.

Currently I am thinking of implementing it in such a way.

CompletableFuture.supplyAsync(
    task1.getTask(),
    task1.getThreadPool
).thenApplyAsync(
    task2.getTask(),
    task2.getThreadPool()
)....

I am keeping a CPU bound task, then a Network IO Bound, then again a CPU, so on and so forth.

I am aware of libraries like Akka, but I feel even this does the job just fine. Also I am hoping to achieve high-throughput with this model, compared to just executing all of them synchronously.

Is there a flaw in my thinking?

  • "...based on the Actor model...": I am not able to recognize the actor paradigm in your code. What messages are you sending from which actor to which actor? – Giorgio Apr 13 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.