+ private ThreadGroup workers;
+ private long reqs = 0;
+
+ public void init() throws ServletException {
+ workers = new ThreadGroup("JSvc worker threads") {
+ public void uncaughtException(Thread t, Throwable e) {
+ log("Worker thread terminated with an uncaught exception", e);
+ }
+ };
+ Properties sprop = new Properties();
+ try {
+ InputStream pi = Servlet.class.getClassLoader().getResourceAsStream("jsvc.properties");
+ try {
+ sprop.load(pi);
+ } finally {
+ pi.close();
+ }
+ } catch(IOException e) {
+ throw(new Error(e));
+ }
+ String clnm = (String)sprop.get("jsvc.bootstrap");
+ if(clnm == null)
+ throw(new ServletException("No JSvc bootstrapper specified"));
+ try {
+ Class<?> rc = Class.forName(clnm);
+ Method cm = rc.getMethod("responder");
+ Object resp = cm.invoke(null);
+ if(!(resp instanceof Responder))
+ throw(new ServletException("JSvc bootstrapper did not return a responder"));
+ root = (Responder)resp;
+ } catch(ClassNotFoundException e) {
+ throw(new ServletException("Invalid JSvc bootstrapper specified", e));
+ } catch(NoSuchMethodException e) {
+ throw(new ServletException("Invalid JSvc bootstrapper specified", e));
+ } catch(IllegalAccessException e) {
+ throw(new ServletException("Invalid JSvc bootstrapper specified", e));
+ } catch(InvocationTargetException e) {
+ throw(new ServletException("JSvc bootstrapper failed", e));
+ }
+ ServletContext ctx = getServletContext();
+ ctx.setAttribute("jsvc.starttime", System.currentTimeMillis());
+ }