Stop me re-inventing the wheel

I have an application to build that does the following.

1. Receives a request for data.

2. Passes the request to other sources.

3. Aggregates the data from all the sources.

4. Returns the aggregated data.

If there are 10 sources and each one takes 10 seconds to return the data and the sources are hit sequentially then it is going to take 100 seconds. However, if I start 10 threads then it will take 10 seconds.

Is there a pattern for aggregating results like this? And even better a worked example in Java ;)

Thanks for your advice.

[584 byte] By [akwattersa] at [2007-10-2 6:27:31]
# 1
You might find the Mediator worth consideration.
Gargoylea at 2007-7-16 13:29:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
if you are using java 1.5, then there is a class to synchronize the work of multiple threads called a cyclic barrier. http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CyclicBarrier.html
jvaudrya at 2007-7-16 13:29:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

> if you are using java 1.5, then there is a class to

> synchronize the work of multiple threads called a

> cyclic barrier.

>

> http://java.sun.com/j2se/1.5.0/docs/api/java/util/conc

> urrent/CyclicBarrier.html

A lot, if not all of those concurrent classes are available for 1.4 also.Search for 'Doug Lea Concurrent' on Google.

dubwaia at 2007-7-16 13:29:23 > top of Java-index,Other Topics,Patterns & OO Design...