int defaultRetries = 1, defaultRetrySleep = 1000; boolean defaultFailover = true; try { parser = new Parser(Parser.getTimeout()); parser.register(switchboardName); Settings.setSettings(parser.switchboard.getSettings()); parser.getFaultTolerantServer(getRetries(defaultRetries), getRetrySleep(defaultRetrySleep), getFailover(defaultFailover)); parser.processObjectsThenDie(); } catch (RemoteException re) { System.err.println(re); if (parser != null) { try { parser.die(true); } catch (RemoteException re2) { System.err.println("couldn't die! (" + re + ")"); }
if (inputFilename != null) { try { parser = new Parser(derivedDataFilename); int bufSize = Constants.defaultFileBufsize; OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(outputFilename), Language.encoding()); BufferedWriter out = new BufferedWriter(osw, bufSize); Sexp sent = null; SexpTokenizer tok = new SexpTokenizer(inputFilename, Language.encoding(), Constants.defaultFileBufsize); Time totalTime = new Time(); Time time = new Time(); for (int i = 1; ((sent = Sexp.read(tok)) != null); i++) { System.err.println("processing sentence No. " + i + ": " + sent); time.reset(); Sexp parsedSent = parser.parse(sent.list()); System.err.println("elapsed time: " + time); out.write(String.valueOf(parsedSent)); out.write("\n"); } System.err.println("\ntotal elapsed time: " + totalTime); System.err.println("\nHave a nice day!"); out.flush(); } catch (RemoteException re) { System.err.println(re); } catch (IOException ioe) { System.err.println(ioe); } catch (ClassNotFoundException cnfe) { System.err.println(cnfe);
  public static void main(String[] args) {    String switchboardName = Switchboard.defaultBindingName;    if (args.length > 1)      switchboardName = args[0];    //Create and install a security manager    if (System.getSecurityManager() == null)      System.setSecurityManager(new RMISecurityManager());    Parser parser = null;    // define fallback-default values for the following three    // fault-tolerance settings    int defaultRetries = 1, defaultRetrySleep = 1000;    boolean defaultFailover = true;    try {      parser = new Parser(Parser.getTimeout());      parser.register(switchboardName);      Settings.setSettings(parser.switchboard.getSettings());      parser.getFaultTolerantServer(getRetries(defaultRetries),				    getRetrySleep(defaultRetrySleep),				    getFailover(defaultFailover));      parser.processObjectsThenDie();    }    catch (RemoteException re) {      System.err.println(re);      if (parser != null) {	try { parser.die(true); }	catch (RemoteException re2) {	  System.err.println("couldn't die! (" + re + ")");	}      }    }    catch (MalformedURLException mue) {      System.err.println(mue);    }    if (debug)      System.err.println("main ending!");  }