Multi-threading design decision... need some ideas... unfortunately it's rather urgent...
Posted on 2006-04-11
Okay, I need help with making a good design decision. Here is my situation. I am willing to offer BIG points.
We have an application that contains a web service to get data from different attorneys. Here's how it works...
since any attorney can sign on to this service at any time we decided to set it up so the client end (non-attorney) makes a call to a single web service to get data.
This web service pulls in IP addresses from a table (IPs for the web services that sit on each attorney side), and then in turn calls another web service based on the IP it pulled.
here are the steps:
- Client calls GetData in WebService1
- WebService1 pulls in IPs (which are the urls for the web services on the attorney end) from a table
- WebService1 sets WebService2's IP to an attorney and has it grab the data
- WebService1 moves on to the next IP and does the same exact thing
- Repeat previous two steps, looping through each IP.
Here is the problem.
If there are 5 attorneys signed up, WebService1 gets to the third attorney and calls WebService2 and they are down, then we have a problem because the client will have to wait a long time while it times out on the third attorney and then moves on to the next... so I figured multi-threading would be a good idea here because I could have 5 (or however many) threads each pull in the data simultaniously and if one is down, then I can at least return the other 4 attorney's data quickly and prompt the user that such-and-such attorney was down and to try again later.
Here is the other problem.
The way this class has been designed makes this difficult for me. Right now it's designed so there is only 1 instance of WebService2 in WebService1 and WebService1 simply "steers" WebService2 to the right URL and when it's finished it "steers" WebService2 to the next URL and makes another call to get data. This makes multi-threading useless because I can't have 5 threads each trying to change the URL of WebService2 at the same time.
Should I bite the bullet and redo this class so it handles multiple WebService2's at the same time? The main problem here is that this is extremely urgent and i'm not sure how daunting it's going to be to re-design this class at this point. Great ideas are worth big points! =)
Thanks for reading all of that!