This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlets / JavaBeans / Thread problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlets / JavaBeans / Thread problem" Watch "Servlets / JavaBeans / Thread problem" New topic

Servlets / JavaBeans / Thread problem

Sarran Vidyakumar

Joined: Mar 26, 2003
Posts: 28
hey guyz:
any help with following wuld be appreciated
for(int i=0;i<20;i++)
someBean bean = new someBean();
the bean.doStuff() creates a socket connetion to an AS/400 system sends
input usin xml & gets back results usin xml(dont bother bout what bean does..i beleive problem on java/tomcat server side)
the SOP works only if the Thread stmt is used & when the thread values r around 1000.. System crashes when we have more loops or when we move program to a faster both these cases the programs responds back when we increase sleep time to 2000..3000 or more..
any suggestions / ideas ???!!
brad balmer
Ranch Hand

Joined: Mar 08, 2004
Posts: 57
You say that your bean.doStuff() opens a socket connection. Is there a specific reason that you need to open and close the socket each iteration? Is it possible to open the socket connection, iterate through, then close the connection?
I may be missing the point, but without too much information with what you intend to do, this is my first thought.
It is sorta covered in the JavaRanch Style Guide.
subject: Servlets / JavaBeans / Thread problem
jQuery in Action, 3rd edition