You may try following snippet as a base for a filter.
(I havn't tried it in a filter chain, so no garantee)
<Filter>
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();
</Filter>
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]