aspose file tools*
The moose likes Beginning Java and the fly likes How many streams should I call ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How many streams should I call ?" Watch "How many streams should I call ?" New topic
Author

How many streams should I call ?

arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Hello,
I have the following scenario:
1. there is one standalone application (Say progA) which asks a user for some information.
2. On clicking of a Go button it has to call a servlet (say A) through URL Connection using ObjectInputStream & ObjectOutputStream. This is my First Stream in this program
3. On reciveing the request it will process and will call another servlet(say B) class through Second URL connection and its stream. This is my second Stream in this program
4. This servlet will do some database entry. and will retrieve some result back to Servlet A.
5. This will than send some data to some other servlet (Say C).
6. Servlet C will do some processing and will send the result to Servlet A.
7. Servlet A will than sends result back to progrA.
8. ProgA will than show a message on this basis to end user.
So the objective in above scenario is to get back the result from Servlet C back to ProgA and than show results.
Though perhaps this couold be possible in this fashion. But My questions are:-
1. Am I doing right?
2. Is there any better approach for this.
regards,
Arun
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Can you explain to us exactly WHY you have 3 different servlets? Is this a distributed application (are the servlets running on different servers)? What are you trying to accomplish by having the 3 servlets.
Why did you choose to NOT just use threads instead?


"JavaRanch, where the deer and the Certified play" - David O'Meara
arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305

Is this a distributed application (are the servlets running on different servers)?

No this is not a distributed application.

What are you trying to accomplish by having the 3 servlets.

This approach is because I already have these servlets (servlet B and C) and integrating both into one is extra work. I can simply pass my request to them and they can do job for me.

Why did you choose to NOT just use threads instead?

I don't know how to use this approach. Can you help me? and what will be the advantage with this.
Perhaps you are right making single servlet will make life easier but I just want to know can approaching this way will make it less efficient.
regards,
Arun
arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Can you help me to solve this issue. Cindy are you around?
regards
Arun
arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
Oh only hope someone will look into this thread too...Pl help me to decide...
regards,
Arun
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well, without knowing the particulars of what you are doing it is sort of difficult to give advice.
If any one or more of these servlets ALSO services some other application/servlet, then there would be a reason to operate them as separate servlets.
But since all 3 of these servlets work together to provide one set of functionality, and there are no OTHER things out there that would call on any one of these servlets separately, then I just do not see the purpose in tracking them as separate servlets.
Why bring 3 things up and down each time, when they all work together as one unit?
But then I really have no idea what you are trying to accomplish.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How many streams should I call ?