tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mel Martinez <melaqu...@yahoo.com>
Subject RE: apache 1.3.12 and tomcat 3.3-m2 connection problem ??
Date Mon, 26 Mar 2001 18:22:03 GMT

--- Jestin Jean-Francois
<Jean-Francois.Jestin@srit.siemens.fr> wrote:
> here are 2 articles speaking about the pushlet
> 
>
http://www.javaworld.com/javaworld/jw-03-2000/jw-03-pushlet.html
> 
>
http://www.javaworld.com/javaworld/jw-03-2000/jw-03-pushlet-2.html
> 
> here is a very simple sample pushlet :
> 
> 
> {
>     public void doGet(HttpServletRequest request,
> HttpServletResponse response)  throws
> ServletException, IOException {
> 
>         ObjectOutputStream out = new
> ObjectOutputStream (response.getOutputStream());
>         response.setContentType("text/plain");   
>         
>         String start = "Http connection opened";
>         
>         out.write(start.getBytes());
>         out.flush();
>    
>         try {
>             for (int cnt=1; cnt > 0; cnt++) {
>                 Thread.sleep(1000);
>                 
>                 String iter = "event=" + cnt + "\n";
>                 out.write(iter.getBytes());
>                 out.flush();
>                 System.out.println("event=" + cnt +
> "pushed.\n");
>             }
>         } catch (Exception e) {
>             System.out.println("error:"+e);
>         }
>         
>         out.close();
>     }
> }
> 

This looks like a VERY bad idea - this will lock up a
connection to the server (and possibly a web server
process)!  This will definitely not scale well.  Also,
it is vulnerable to server crash, something likely to
happen if you had even a moderate amount of traffic
going to 'pushlets'.

It might be best to have the browser redirected over
to a separate, dedicated pushlet server (on a separate
box) for this.  I sure wouldn't want it sharing
resources with the rest of my 'normal' servlets.

NitPick: You should send error messages to System.err,
not System.out.  :-)

Cheers,

mel







__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Mime
View raw message