Actors may not be that cheap. I tried to create a worker actor every time 
the master actor received a start job message and found out that it created 
a new thread to run it. Seems to me that the default dispatcher is an 
unbounded thread pool. It doesn't look good to me -- it falls back to the 
thread per request model???

Since the jobs are CPU intensive, I have to control the number of 
concurrent jobs. Here's an update of the code. It works to me. Just want to 
clarify if this a right way to do.

// When master actor receive startJob message, creates a new worker actor 
with a predefined dispatcher with a fixed thread pool to control the number 
of concurrent jobs.
ActorRef worker = 
getContext().actorOf(Props.create(Worker.class).withDispatcher("my-blocking-dispatcher"));
worker.tell(job, self());



-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to