Perform the taks using the aggregator message-ow pattern. Divide a range
1..MAX (where MAX is a large number) into subranges and use xed-sized pool of ephemeral threads to
obtain the sum of prime numbers in each subrange (you can reuse code from your previous assignment).
Try distributing work more uniformly than the consecutive ranges used in A1.
Print individual sums as they become available, and the nal sum at the end. The aggregator thread
should accumulate individual sums in future objects and return the nal sum to the client. The client
thread, after launching ephemeral threads, should continue printing information about the ranges it has
divided, and wait for the aggregated sum before termination. Also execute a single-threaded version and
verify the correctness of the nal sum.
Answers
Answered by
35
Answer:
Which one of the statements describes a service aggregator pattern? (Choose the best answer.)
A. It is implemented in each service separately and uses a streaming service
B. It involves implementing a separate service that makes multiple calls to other backend services
C. It uses a queue on both sides of the service communication
D. It involves sending events through a message broker
Similar questions