Replaced ContextResponder with a more generic Destroyable interface.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 28 Mar 2011 23:58:04 +0000 (01:58 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 28 Mar 2011 23:58:04 +0000 (01:58 +0200)
src/dolda/jsvc/ContextResponder.java [deleted file]
src/dolda/jsvc/Destroyable.java [new file with mode: 0644]
src/dolda/jsvc/ThreadContext.java
src/dolda/jsvc/util/PerSession.java

diff --git a/src/dolda/jsvc/ContextResponder.java b/src/dolda/jsvc/ContextResponder.java
deleted file mode 100644 (file)
index 1ff7b44..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package dolda.jsvc;
-
-public interface ContextResponder extends Responder {
-    public void destroy();
-}
diff --git a/src/dolda/jsvc/Destroyable.java b/src/dolda/jsvc/Destroyable.java
new file mode 100644 (file)
index 0000000..deb90eb
--- /dev/null
@@ -0,0 +1,5 @@
+package dolda.jsvc;
+
+public interface Destroyable {
+    public void destroy();
+}
index b6d9677..36b0121 100644 (file)
@@ -118,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) {
index 562e2c9..0bb1ab0 100644 (file)
@@ -93,8 +93,8 @@ public class PerSession implements Responder {
            if(resp == null) {
                resp = create(sess);
                sess.put(rcl, resp);
-               if(resp instanceof ContextResponder) {
-                   final ContextResponder cr = (ContextResponder)resp;
+               if(resp instanceof Destroyable) {
+                   final Destroyable cr = (Destroyable)resp;
                    sess.listen(new Session.Listener() {
                            public void destroy(Session sess) {
                                cr.destroy();