Contact:   Tel: 2726  -  New Media Systems, 1st Floor South, Queens Walk


This might not anwser your question directly but...

Although you created 10 servlets running threads, you have only one copy of
(req, res). For that you might want to synchronize at least the use of the res
objects? Don't know what is done inside each servlet but if they change anything
in servlet context, you will run into problems?


Cheers,


Charles






"???" <[EMAIL PROTECTED]> on 10/10/2000 09:08:53 AM

To:        [EMAIL PROTECTED]
cc:         (bcc: Charles Chen/YellowPages)
From:      "???" <[EMAIL PROTECTED]>, 10 October 2000, 9:08 a.m.

[Emer.]  ServletContext Problem in JRun 3.0!!!!  [Scanned by Yellow Pages
PostMaster]


i made sample servlet that invoking 10 servlets program with ServletContext.
Below lines is a part of sample servlet source code...
-----------------------------------------------
RequestDispatcher[] dispatcher = new RequestDispatcher[10];
  ServletContext context = getServletContext();
  dispatcher[0] = context.getRequestDispatcher("/servlet/WorkingServlet1");
  dispatcher[1] = context.getRequestDispatcher("/servlet/WorkingServlet2");
  dispatcher[2] = context.getRequestDispatcher("/servlet/WorkingServlet3");
  dispatcher[3] = context.getRequestDispatcher("/servlet/WorkingServlet4");
  dispatcher[4] = context.getRequestDispatcher("/servlet/WorkingServlet5");
  dispatcher[5] = context.getRequestDispatcher("/servlet/WorkingServlet6");
  dispatcher[6] = context.getRequestDispatcher("/servlet/WorkingServlet7");
  dispatcher[7] = context.getRequestDispatcher("/servlet/WorkingServlet8");
  dispatcher[8] = context.getRequestDispatcher("/servlet/WorkingServlet9");
  dispatcher[9] = context.getRequestDispatcher("/servlet/WorkingServlet10");

WorkingThread[] thread = new WorkingThread[10];

  for (int i = 0;i < DISPATCHER_SIZE;i++)
  {
   thread[i] = new WorkingThread(req, res, dispatcher[i]);
   thread[i].start();
  }
----------------------------------------------------------------
WorkingThead.java  is.....

public class WorkingThread extends Thread
{
 private HttpServletRequest req = null;
 private HttpServletResponse res = null;
 private RequestDispatcher dispatcher = null;

 public WorkingThread(HttpServletRequest req, HttpServletResponse res,
   RequestDispatcher dispatcher)
 {
  this.req = req;
  this.res = res;
  this.dispatcher = dispatcher;
 }

 public void run()
 {
  try
  {
   if(dispatcher != null)
    dispatcher.include(req, res);
   else
    System.out.println("dispatch is null");
  }
  catch(Exception e) {System.err.println(e);}
 }
}
----------------------------------------------------------------------------
you can easily understand source.
First servlet source make 10 WorkingThread and start them.
WorkingThread class only excutes dispatcher.include().
But ServletContext cannot find or initialize all WorkingServletX but
only one or two WorkingServletX.
WorkingServletX writes some words which not important through
PrintWirter.
After WorkingServletX do not close PrintWriter after writing some words .

i cannot understand why all WorkingServletX are not initialize and
not be executed.

In JSDK2.1......All about things above is working with no problem...
ONLY JRun has problem........

Help me......??!?!?!?!?!?!?!?!?!???

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to