Added timelimits to threads.
[jsvc.git] / src / dolda / jsvc / RequestThread.java
1 package dolda.jsvc;
2
3 public class RequestThread extends Thread {
4     private Request req;
5     private Responder resp;
6     private long stime = 0;
7     
8     public RequestThread(Responder resp, Request req, ThreadGroup th, String name) {
9         super(th, name);
10         this.resp = resp;
11         this.req = req;
12     }
13     
14     public void run() {
15         stime = System.currentTimeMillis();
16         resp.respond(req);
17         try {
18             req.output().close();
19         } catch(java.io.IOException e) {
20             throw(new RuntimeException(e));
21         }
22     }
23     
24     public static Request request() {
25         return(((RequestThread)Thread.currentThread()).req);
26     }
27     
28     public long stime() {
29         return(stime);
30     }
31 }