So, this is my first project where I need to manage a large number of concurrent 
requests.  And, to make things worse, most of my previous experience in programming is 
Visual Basic for Applications running in either Excel or Access.  (Don't worry, it 
gets more on topic...)

So, I now have an Oracle backend that's supposed to be accessed by jsps and servlets.  
Which works.  However, if a user gets impatient (I know, it never happens, but just in 
case!), then while the database is doing it's thing, the java process receives a new 
request and starts a new thread, right?  But this is a problem in that it stops 
responding.  Entirely.  I don't know if this means that my db connection got closed 
midway through the second process (which should now have the request and response 
instances that my browser wants back), and therefore it's sitting there going "which 
way did it go, which way did it go" (you have to imagine the silly cartoon voice), or 
what.  And I don't really know that connection pooling will help.

Now, more experinced minds than mine have solved this before.  Most commercial/decent 
sites seem to handle it fine:  do they simply interrupt the old process and then start 
a new one?  Should the beginning of my db-routine have something like:

Connection con = null;  //to close any currently running process on this connection in 
this object/bean/servlet
try
{
  crap;
} catch (crappyException ce) {
  handle it
}  finally  {
  if (con!=null)
  {
    con.close();
    con=null;
  }
}

Would that solve my problem?  Or do I need to let the first request finish itself and 
then start a new one?  Any ideas?

Thanks for your time.

Michael Nicholson

Reply via email to