akka patterns.ask implementation details -


we have use case have set following: master type of actor , worker type of actor.

the master receives work request input , uses workers orchestrate , generate result.

there plan create java class named client.java. creates new instance of master , sends work it. client uses - patterns.ask future pointers , later blocks on until results arrived.

patterns.ask(master, initialmessage, t);       await.result message 

the internal documentation of patterns.ask says temporary actor created. but, when invoke , try print hashcode of sender inside master, seemed same actor every time.

i have following concerns:

  1. how concurrent invocations of patterns.ask managed? can happen thread after calling, ask gets future pointer wrong data put in it?
  2. how guarantee future pointers filled relevant responses , not mixed responses others?
    ex: futurex = future expecting x message
    futurey = future expecting y message
    can ever happen futurex y , futurey gets x?

i haven't read patterns.ask internal documentation assume utilizes actorref.forward(message, context) in order stick message sender.

also, shouldn't block (await.result()) , should apply callbacks instead using factory method provided akka.dispatch.futures. you'll able chain , recover future tasks (and more) , way better application performance described here:

http://doc.akka.io/docs/akka/2.3.12/java/futures.html#functional_futures


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -