Java equivalent for Python pool.map/ Multiprocessing -
i wondering if point me simple equivalent of python's multiprocessing module in java.
i have simple parallel processing scenario (where no 2 processes interact): take data set , split 12 , apply java method 12 datasets, collect results , join them in list of sort same ordering.
java being "pro" language appears have multiple libraries , methods - can java newbie started?
i minimal of coding - said requirement pretty straightforward.
update: how multiprocessing in java, , speed gains expect?
this seems indicate threads way go. expect have no choice wade bunch of locks (pun unintended) , wait ship sail. simple examples welcome nevertheless.
there's no exactly-compatible class, executorservice
gives need implement it.
in particular, there's no function map callable
on collection
, wait on results, can build collection<callable<t>>
out of callable<t>
, collection<t>
, call invokeall
, returns list<future<t>>
.
(if want emulate of other functions multiprocessing.pool
, need loop around submit
instead , build own collection of things wait on. map
simple.)
Comments
Post a Comment