java - Sharing mutable objects between actors -


i have following scenario

actor a receives request , delegates work 2 child actors actor b , actor c . both these actors change state of object parent actor not depend on result of of these actors

is anti pattern? how possible distribute load without passing object?

here example in scala logic same

class parentactora extends actor {   val childactorb: actorref = _   val childactorc: actorref = _    def receive: receive = {      case r: request =>        childactorb ! delegate(r)        childactorc ! delegate(r)      case n: childnotification => //change local state based on notification child actor          } }  class childactora extends actor {    def receive: receive = {       case delegate(r) => //do work , notify parent childnotification object    } } 

Comments