RE: Tomcat5 and Servlet Timeout: Possible?

2004-09-08 Thread Ralph Einfeldt

You may try following snippet as a base for a filter.
(I havn't tried it in a filter chain, so no garantee)


InterruptTimer mTimer = new InterruptTimer(5000, 10);
mTimer.start();
try {

  doChain() // Don't have the correct syntax at hand...

} catch (??InterruptedIOException?? ex) {

  // Log what you think to be helpfull

}
mTimer.reset();



public class InterruptTimer extends Thread {
long oEndTime = 0;
int oSleepTime = 10;
Thread oStartingThread = Thread.currentThread();
Thread oRunningThread = null;

public InterruptTimer(int aLength, int aSleepTime) {
// Both times are in ms
oSleepTime = aSleepTime;
oEndTime = System.currentTimeMillis() + aLength;
}

public void run() {
oRunningThread = Thread.currentThread();
// Loop until the end time is reached or reset() was called.
while (System.currentTimeMillis() < oEndTime) {
try { 
Thread.sleep(oSleepTime);
} catch (InterruptedIOException ex) {
}
}
if (oEndTime > 0) {
timeout();
}
}
public void reset() {
oEndTime = 0;
}

public void timeout() {
oStartingThread.interrupt();
}
}

> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] Behalf Of Andreas Schildbach
> Sent: Tuesday, September 07, 2004 9:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Tomcat5 and Servlet Timeout: Possible?
> 
> 
> Shapira, Yoav wrote:
> 
> > There's no such option in Tomcat.
> 
> So if one thread hangs, it hangs forever.
> 
> If it blocks other threads, the whole app hangs...
> 
> Regards,
> 
> Andreas
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

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



Re: Tomcat5 and Servlet Timeout: Possible?

2004-09-07 Thread Andreas Schildbach
Shapira, Yoav wrote:
There's no such option in Tomcat.
So if one thread hangs, it hangs forever.
If it blocks other threads, the whole app hangs...
Regards,
Andreas
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Tomcat5 and Servlet Timeout: Possible?

2004-09-07 Thread Shapira, Yoav

Hi,
There's no such option in Tomcat.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: news [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Schildbach
>Sent: Tuesday, September 07, 2004 3:09 PM
>To: [EMAIL PROTECTED]
>Subject: Tomcat5 and Servlet Timeout: Possible?
>
>Hello everyone,
>
>I'm a bit puzzled at the moment.
>
>Isn't there an option to Tomcat5 that specifies a servlet timeout?
>(maximum the a servlet may take to execute, after which the
>corresponding thread is killed) I could only find connection timeout...
>
>Regards,
>
>Andreas
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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