A follow up to my previous mail.
You may try following snippet.
(I havn't tried it in a filter chain, so I'm not shure
if the exception reaches the 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();
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: Ralph Einfeldt
> Sent: Friday, May 07, 2004 7:12 PM
> To: Tomcat Users List
> Subject: RE: How to limit time for Connector threads?
>
> - Extend the filter to interrupt the current thread
> if it takes to long and dump some data.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]