Minor fixes for StandaloneServletClient

This commit is contained in:
hns 2001-03-05 19:19:54 +00:00
parent e383beaa08
commit 45da518a63
4 changed files with 38 additions and 33 deletions

View file

@ -62,32 +62,29 @@ public class TypeManager implements Runnable {
public void check () {
// long now = System.currentTimeMillis ();
// System.out.print ("checking "+Thread.currentThread ());
try {
String[] list = appDir.list ();
for (int i=0; i<list.length; i++) {
File protoDir = new File (appDir, list[i]);
// cut out ".." and other directories that contain "."
if (isValidTypeName (list[i]) && protoDir.isDirectory ()) {
Prototype proto = getPrototype (list[i]);
if (proto != null) {
// check if existing prototype needs update
// app.logEvent (protoDir.lastModified ());
updatePrototype (list[i], protoDir, proto);
} else {
// create new prototype
proto = new Prototype (protoDir, app);
registerPrototype (list[i], protoDir, proto);
prototypes.put (list[i], proto);
if ("hopobject".equalsIgnoreCase (list[i]))
nodeProto = proto;
// give logger thread a chance to tell what's going on
Thread.yield();
}
String[] list = appDir.list ();
if (list == null)
throw new RuntimeException ("Can't read app directory "+appDir+" - check permissions");
for (int i=0; i<list.length; i++) {
File protoDir = new File (appDir, list[i]);
// cut out ".." and other directories that contain "."
if (isValidTypeName (list[i]) && protoDir.isDirectory ()) {
Prototype proto = getPrototype (list[i]);
if (proto != null) {
// check if existing prototype needs update
// app.logEvent (protoDir.lastModified ());
updatePrototype (list[i], protoDir, proto);
} else {
// create new prototype
proto = new Prototype (protoDir, app);
registerPrototype (list[i], protoDir, proto);
prototypes.put (list[i], proto);
if ("hopobject".equalsIgnoreCase (list[i]))
nodeProto = proto;
// give logger thread a chance to tell what's going on
Thread.yield();
}
}
} catch (Exception ignore) {
app.logEvent (this+": "+ignore);
}
if (rewire) {
@ -143,7 +140,9 @@ public class TypeManager implements Runnable {
// app.logEvent ("Typechecker interrupted");
break;
}
check ();
try {
check ();
} catch (Exception ignore) {}
}
}

View file

@ -31,7 +31,7 @@ public class ParentInfo {
}
isroot = "root".equals (propname);
System.err.println ("created "+this);
// System.err.println ("created "+this);
}
public String toString () {

View file

@ -609,6 +609,7 @@ public class Node implements INode, Serializable {
anonymous = !pinfo.named;
if (pinfo.virtualname != null)
pn = pn.getNode (pinfo.virtualname, false);
// FIXME: check for groupby
if (pn != null)
return pn;
}

View file

@ -18,7 +18,7 @@ import helma.util.*;
public class StandaloneServletClient extends AbstractServletClient {
private IRemoteApp app = null;
private Application app = null;
private String appName;
private String serverProps;
@ -30,14 +30,19 @@ public class StandaloneServletClient extends AbstractServletClient {
super.init (init);
}
IRemoteApp getApp (String appID) throws Exception {
synchronized IRemoteApp getApp (String appID) throws Exception {
if (app != null)
return app;
File propfile = new File (serverProps);
File hopHome = new File (propfile.getParent());
SystemProperties sysProps = new SystemProperties (propfile.getAbsolutePath());
app = new Application (appName, sysProps, hopHome);
try {
File propfile = new File (serverProps);
File hopHome = new File (propfile.getParent());
SystemProperties sysProps = new SystemProperties (propfile.getAbsolutePath());
app = new Application (appName, sysProps, hopHome);
app.start ();
} catch (Exception x) {
System.err.println ("Error starting Application "+appName+": "+x);
x.printStackTrace ();
}
return app;
}