Made the server context a more useful concept.
[jsvc.git] / src / dolda / jsvc / ContextParam.java
index f146dc3..ebdd9a7 100644 (file)
@@ -22,7 +22,7 @@ public class ContextParam<T> {
        Thread th = Thread.currentThread();
        if(perthr.containsKey(th))
            return(perthr.get(th));
-       ThreadContext ctx = getctx();
+       ThreadContext ctx = ThreadContext.current();
        if(perctx.containsKey(ctx))
            return(perctx.get(ctx));
        if(!bound)
@@ -31,18 +31,10 @@ public class ContextParam<T> {
     }
        
     public synchronized T ctxset(T val) {
-       ThreadContext ctx = getctx();
+       ThreadContext ctx = ThreadContext.current();
        return(perctx.put(ctx, val));
     }
     
-    private static ThreadContext getctx() {
-       for(ThreadGroup tg = Thread.currentThread().getThreadGroup(); tg != null; tg = tg.getParent()) {
-           if(tg instanceof ThreadContext)
-               return((ThreadContext)tg);
-       }
-       return(null);
-    }
-    
     public static Responder let(final Responder next, Object... params) {
        final Map<ContextParam, Object> values = new HashMap<ContextParam, Object>();
        if((params.length % 2) != 0)