Merge branch 'master' of git.dolda2000.com:/srv/git/r/jsvc
[jsvc.git] / src / dolda / jsvc / ThreadContext.java
index d0e32fd..6eb7d87 100644 (file)
@@ -72,7 +72,10 @@ public class ThreadContext extends ThreadGroup {
                if(st.st == "killed")
                    logger.log(Level.WARNING, "Thread " + rt + " refused to die; killing again");
                if(now - st.lastkill > 5000) {
-                   rt.stop();
+                   if(forcelimit)
+                       rt.stop();
+                   else
+                       rt.interrupt();
                    st.st = "killed";
                    st.lastkill = now;
                } else {
@@ -115,8 +118,8 @@ public class ThreadContext extends ThreadGroup {
     }
     
     public void shutdown() {
-       if(root instanceof ContextResponder)
-           ((ContextResponder)root).destroy();
+       if(root instanceof Destroyable)
+           ((Destroyable)root).destroy();
        try {
            long last = 0;
            while(true) {
@@ -140,6 +143,10 @@ public class ThreadContext extends ThreadGroup {
        return(ctx.worker(root, req, workers, "Worker thread " + reqs++));
     }
     
+    public long requests() {
+       return(reqs);
+    }
+    
     private Responder bootstrap(final Class<?> bootclass) {
        final Throwable[] err = new Throwable[1];
        final Responder[] res = new Responder[1];