-2

From an actor (akka.actor.Actor) how can I execute a method twice simultaneously? Try to do it with Futures, but if the future does not respond, the actor does not take more requests ...

3
  • 2
    How about to actually include some piece of code in your question that represents your current issue? Mar 24, 2017 at 16:53
  • "if the future does not respond, the actor does not take more requests" - that doesn't seem right, i.e. that's not the case if you use Futures in the intended way. Could you post the code in question?
    – lutzh
    Mar 25, 2017 at 15:56
  • Sorry.. I assumed it was very simple. :(
    – jamlhet
    Mar 28, 2017 at 14:19

1 Answer 1

1

Generally, actors should not block. Dealing with actors, you should think in dataflow manner. Draw a dataflow diagram like this:

          --> methodCall1 --> |----------|
 actor1 /                     |  actor2  |  
        \ --> methodCall2 --> |__________|

Actor2 can be inplemented as an Akka actor, which counts incoming messages and reacts when both messages has arrived. In this case, methodCall1 and methodCall must know actor2 and send messages to it.

Or actor2 can be a CompletableFuture which is derived from the future of one of method calls using method thenCombine.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.