W3C home > Mailing lists > Public > www-jigsaw@w3.org > March to April 2001

Client Side API - An easy way to timeout Requests.

From: John Philip Anderson <jpanderson_215@hotmail.com>
Date: Thu, 08 Mar 2001 20:39:20 -0000
To: www-jigsaw@w3.org
Message-ID: <F156tNtzsG06vdGg1fD000032c5@hotmail.com>
Dear Gentlemen,

	I have spent the entire week try to implement Request timeouts in 
Client-Side Jigsaw (only to find out that my problem is not with Jigsaw, but 
rather some third-party advertisement server that takes up to five minutes 
to deliver a puny GIF file).  However, while working on my problem, I did 
find a solution to implementing Request timeouts on the Client-Side without 
modifying the Jigsaw source code.

	Basically, one can construct HttpManagerThreads to run Requests that have 
been created by an HttpExecutiveManager.  Once the HttpExecutiveManager 
starts a HttpManagerThread, it calls wait(timeout milliseconds) on itself 
until either (1) the HttpManagerThread notifies it with a Reply or (2) it 
times out, destroys that HttpManagerThread, and then starts a new 
HttpManagerThread to try running the request again.  This scheme appears to 
be clean and it works well (of course the real solution lies in finishing 
the Client-Side Jigsaw source code).  Below I have posted outlines of the 
two classes that I have used to implemented Request timeouts on the 

		Truly yours,
		John Philip Anderson


public class HttpManagerThread extends Thread{

	Reply reply;
	Request request;
	HttpManager manager;
	HttpExecutiveManager executivemanager;

	HttpManagerThread (Request request, HttpExecutiveManager executivemanager){
		this.request = request;
		this.executivemanager = executivemanager;
		manager = HttpManager.getManager();
		} catch(PropRequestFilterException prfexcpt) {
			System.out.println("PropRequestFilterException : " + prfexcpt);

	public void run(){
		try{	reply = manager.runRequest(request);
		}catch(HttpException httpexcpt){
			System.out.println("HttpException: httpexcpt);

	protected void returnReply(Reply reply){

public class HttpExecutiveManager{

	int timeout;
	boolean replytaken;
	Request request;
	HttpManager manager;

	HttpExecutiveManager(int timeout){
		this.timeout = timeout;
		manager = HttpManager.getManager();
		request = manager.createRequest();

	public synchronized void read(){
		replytaken = false;
			HttpManagerThread httpmanagerthread = new HttpManagerThread(request, 
			try{	this.wait(timeout);
			} catch(InterruptedException intrpexcpt) {
				System.out.println("InterruptedException: " + intrpexcpt);
			httpmanagerthread = null;

	public synchronized void takeReply(Reply reply){
		this.reply = reply;
		replytaken = true;

Get your FREE download of MSN Explorer at http://explorer.msn.com
Received on Thursday, 8 March 2001 15:39:55 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:37 UTC