> 
> In the near future we want to port our PHP-driven framework/cms (which
> has
> been proven in development and production) to JAVA. So I am looking for
> the
> fastest possible way to do this, without developing anything new from
> the
> scratch.

It sounds like you're not using Struts but are trying to come up with
functionality similar to it.  Is this not the slowest way possible to port
an app to what is essentially a Struts type framework?  It's not clear why
you're planning a more complicated approach with threads running all over
the place and replicating Struts features instead of just using the real
thing.

David

> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Yee, Richard K,,DMDCWEST" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Tuesday, August 19, 2003 5:41 PM
> Subject: RE: [OT] Question about Servlets & Threads
> 
> 
> > Jan,
> > How long does your thread take to run? Since you are waiting for the
> thread
> > to finish anyway in your servlet, I'm not sure it is very necessary to
> start
> > a new thread to process the request. It adds a bit of overhead to
> process
> > each request since an extra thread is created for every request that
> gets
> > processed. If this is really necessary, then you also might look into
> using
> > a thread pool. I don't see the need for the new thread. Perhaps you
> can
> > describe what you are doing in this thread. As I suggested in my
> previous
> > email, you could use a utility class as an interface between your
> servlet
> > and your business logic or just handle everything in methods in your
> > servlet.
> >
> > One more thing suggestion is to name your parameters with mor
> descriptive
> > names. ie. change this
> > protected void doGet(HttpServletRequest arg0, HttpServletResponse
> arg1)
> > throws ServletException, IOException{
> >     process(arg0, arg1);
> > }
> >
> > to
> >
> > protected void doGet(HttpServletRequest request, HttpServletResponse
> > response) throws ServletException, IOException{
> >     process(request, response);
> > }
> >
> > (you could also use req and resp instead of request and response)
> >
> > Regards,
> >
> > Richard
> >
> > -----Original Message-----
> > From: Jan Zimmek [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, August 19, 2003 1:17 AM
> > To: Struts Users Mailing List
> > Subject: Re: [OT] Question about Servlets & Threads
> >
> >
> > Hi,
> >
> > I think you're right, but let me ask a last question please ;-)
> >
> > here are some source snippets of my classes:
> >
> > MyServlet (which handles all incoming requests like ActionServlet in
> struts
> > and populates Request/Response and the action to execute to the new
> created
> > WebThread):
> > -------------------------------------------------
> > protected void doGet(HttpServletRequest arg0, HttpServletResponse
> arg1)
> > throws ServletException, IOException{
> >     process(arg0, arg1);
> > }
> >
> > protected void doPost(HttpServletRequest arg0, HttpServletResponse
> arg1)
> > throws ServletException, IOException{
> >     process(arg0, arg1);
> > }
> >
> > protected void process(HttpServletRequest request, HttpServletResponse
> > response) throws ServletException, IOException{
> >     WebThread t = new WebThread(request, response, new WebAction());
> >
> >     t.start();
> >
> >     while(t.isAlive());
> >
> >     t.release();
> >     t = null;
> > }
> >
> > You see all processing is of the request will be done in the "run()"
> method
> > of the new created WebThread instance.
> >
> > And this is the point why I am not understand, that I can run into
> complex
> > threading issues.
> >
> > Snippet of a WebAction-Object (this is always thread-safe like a
> struts
> > action):
> >
>
--------------------------------------------------------------------------
> --
> > ---
> >
> > public void execute(){
> >     HttpServletResponse response = Globals.response();
> >
> >     try{
> >         response.getWriter().write("<html>****</html>");
> >     }catch(IOException e){
> >         e.printStackTrace();
> >     }
> > }
> >
> >
> > And this is the Globals-Object source:
> > --------------------------------------
> >
> > public class Globals{
> >     private static WebThread current(){
> >         return (WebThread)Thread.currentThread();
> >     }
> >
> >     public static HttpServletRequest request(){
> >         return current().getRequest();
> >     }
> >
> >     public static HttpServletResponse response(){
> >         return current().getResponse();
> >     }
> > }
> >
> > The Globals-class simply returns the Request/Response-Object of the
> current
> > WebThread (subclass of Thread) via "getter"-methods. I have tested
> MyServlet
> > by making multiple concurrent request by an application (running 10
> thread
> > each making 1000 requests in a loop). Each request has been processed
> > correctly.
> >
> > Hope this message is not so long that you directly drop, because I am
> very
> > occupied with this subject.
> >
> > Any comments would be very appreciated.
> >
> > greets
> > Jan Zimmek
> >
> >
> > ----- Original Message ----- 
> > From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Tuesday, August 19, 2003 4:38 AM
> > Subject: Re: [OT] Question about Servlets & Threads
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to