1 package org.sapia.ubik.rmi.server.transport.http; 2 3 import org.sapia.ubik.net.PooledThread; 4 import org.sapia.ubik.net.Uri; 5 6 import simple.http.Request; 7 import simple.http.Response; 8 import simple.http.load.ActiveService; 9 import simple.http.serve.Context; 10 11 12 23 public class UbikHttpHandler extends ActiveService { 24 private HttpAddress _addr; 25 private HttpRmiServerThreadPool _pool; 26 27 public UbikHttpHandler(Uri localHostUri, Context ctx, int maxThreads) { 28 super(ctx); 29 _addr = new HttpAddress(localHostUri); 30 _pool = new HttpRmiServerThreadPool(true, maxThreads); 31 } 32 33 36 protected void process(Request req, Response res) throws Exception { 37 HttpRmiServerConnection conn = new HttpRmiServerConnection(_addr, req, res); 38 PooledThread th = (PooledThread) _pool.acquire(); 39 th.exec(new org.sapia.ubik.net.Request(conn, _addr)); 40 } 41 } 42 | Popular Tags |