The following screenshot shows the result of an execution of this example:
The problem resolved in the example is simple. We have a big matrix of random integers, and you want to know the total number of occurrences of a number in this matrix. To get better performance, we used the divide and conquer technique. We divided the matrix into five subsets and used a thread to look for the number in each subset. These threads are objects of the Searcher class.
We used a CyclicBarrier object to synchronize the completion of the five threads and execute the Grouper task to process partial results and calculate the final one.
As mentioned ...