This sounds like a great solution. I would however recommend that you stop
the thread in the destroy() method. You wouldn't want a new thread started
gathering your data every time the servlet engine decided to unload/reload
your servlet.
John Zerbe - Mellon Bank
Phone: 412-234-1048 E-Mail:[EMAIL PROTECTED]
> -----Original Message-----
> From: Cezar Totth [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, July 12, 1999 9:29 AM
> To: [EMAIL PROTECTED]
> Subject: Re: C or Java?
>
> Hi,
> On Mon, 12 Jul 1999, Mark Galbreath wrote:
> >....
> > I thought of servlet chaining - have one servlet make the network
> > connectin and read in the data into memory every 10 seconds, while the
> > second servlet continuously delivers the homepage with the formated data
> > to HTTP requests.
> You dont need neither servlet chaining nor a sepparate servlet to make the
> network connection and get data from the second server.
>
> Use a servlet that:
> - has a variable:
> static Hashtable gatheredData = null;
> - implements Runnable through a run() call.
> Put in run(){ }, in an endless loop:
>
> while(true) {
> the connecting to the secondary server, using java.net.UrlConnection
> or just Socket,
> get the data and fill the gatheredData hashtable with it.
>
> Thread.sleep(10000); // milliseconds.
> }
>
> - during servlet's init() check if gatheredData is null.
> if it is null, instantiate it with a new Hashtable() and launch
> a new Thread(this)
>
> So have the same servlet will answer Http requests within doGet() or
> doPost(), gather updated remote infos within run(), and initiate
> everything (e.g. server's B address and port) within init().
>
> Cezar.
> >
> > Can a servlet make a call to a CGI script on a remote server and accept
> > the result?
> >
> >
> > -mark
> >
> > >>> Rod McChesney <[EMAIL PROTECTED]> 7/11/99 07:44:41 PM >>>
> > How about option 3 of calling server A call from Java and using a
> > servlet for the whole process?
> >
> > Rod McChesney, Korobra
> >
> >
> > Mark Galbreath wrote:
> > >
> > > Question of speed of delivery.
> > >
> > > Scenario:
> > > I have a remote server A that calls remote server B through the
> firewall to retrieve a pipe-delimited string of real-time market quotes.
> At present the webserver makes a Perl CGI call to server A to get the
> data, formats it into an HTML table, and serves it up on the homepage
> (www.troweprice.com). So every HTTP GET request to the webserver spawns a
> separate process to fetch and process the quote data.
> > >
> > > New Design Options (forget CORBA for the moment):
> > > 1. Have a cron run the Perl script to write the quote data to a
> flatfile every 10 seconds; have a Java servlet read that file every five
> seconds, holding the data in memory, and delivering the formatted HTML to
> the clients per request by spawning multiple threads.
> > >
> > > 2. Have a cron run a C version of the script to get the data every 10
> seconds and renew an otherwise static HTML page that will be served by the
> webserver per every HTTP GET request.
> > >
> > > Which solution do you think would be the faster? Are there others I
> am neglecting?
> > >
> > > Thanks for the input (pun intended)!
> > >
> > > -mark
> > >
> > >
> __________________________________________________________________________
> _
> > > 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
> >
> >
> __________________________________________________________________________
> _
> > 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
___________________________________________________________________________
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