]> git.dolda2000.com Git - jsvc.git/commitdiff
A couple of bugfixes.
authorFredrik Tolf <fredrik@dolda2000.com>
Fri, 16 Oct 2009 01:04:32 +0000 (03:04 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Fri, 16 Oct 2009 01:04:32 +0000 (03:04 +0200)
src/dolda/jsvc/ThreadContext.java
src/dolda/jsvc/j2ee/Servlet.java
src/dolda/jsvc/store/FileStore.java

index 2d9931e9d35c521d15baaff6da44ef801052d0c2..486bc91bb268fa5d7e1d5af06d569fd0c48dad00 100644 (file)
@@ -86,9 +86,12 @@ public class ThreadContext extends ThreadGroup {
            boot.interrupt();
            Thread.currentThread().interrupt();
        }
-       if(err[0] != null)
+       if(err[0] != null) {
+           destroy();
            throw(new RuntimeException(err[0]));
+       }
        if(res[0] == null) {
+           destroy();
            logger.log(Level.SEVERE, "No responder returned in spite of no error having happened.");
            throw(new NullPointerException("No responder returned in spite of no error having happened."));
        }
index 2b149c910bb36ae340a4c2a977ea1da56845bba1..d726474bc87746c8765f052a37da5eb3f228a987 100644 (file)
@@ -31,7 +31,13 @@ public class Servlet extends HttpServlet {
        } catch(ClassNotFoundException e) {
            throw(new ServletException("Invalid JSvc bootstrapper specified", e));
        }
-       tg = new ThreadContext(null, "JSvc service", J2eeContext.create(cfg), bc);
+       ServerContext ctx = J2eeContext.create(cfg);
+       String tgn;
+       if(ctx.name() != null)
+           tgn = "JSvc service for " + ctx.name();
+       else
+           tgn = "JSvc service";
+       tg = new ThreadContext(null, tgn, ctx, bc);
     }
     
     public void destroy() {
index 17a8f889cdcf0ed45d77b33ad2e4fabef25994ca..55c15d7a379a530e66ca2725ff5bca5e4c942983 100644 (file)
@@ -38,8 +38,10 @@ class FileStore extends Store {
        this.base = new java.io.File(base, nm.substring(p));
        AccessController.doPrivileged(new PrivilegedAction<Object>() {
                public Object run() {
-                   if(!FileStore.this.base.mkdirs())
-                       throw(new RuntimeException("Could not create store directory (Java won't tell me why)"));
+                   if(!FileStore.this.base.exists()) {
+                       if(!FileStore.this.base.mkdirs())
+                           throw(new RuntimeException("Could not create store directory (Java won't tell me why)"));
+                   }
                    return(null);
                }
            });