multithreading - Java mastar-worker communication -
here's need:
a master task create bunch of worker tasks.
once each worker finishes job, needs report master.
as master receives predefined number of responses, save these results. needed because inserting results 1 one take more time inserting bunch of them @ once , waiting results might result in outofmemoryexception.
i've looked each worker calling method on master , synchronizing wait() , notify() , using threadpoolexecutor , afterexecute(..) method getting result workers, i'm still not sure best way achieve need.
edit: should mention java app.
use blockingqueue master waits (queue.take()
) worker place result (queue.put()
).
Comments
Post a Comment