Re: Spreadsheet & Remote Data Servers

To make things a bit easier, this hunk of code:

>     // start up remote server
>     System.out.println("Starting remote server...");
>     RemoteServerImpl rsi = null;
>     try {
>       rsi = new RemoteServerImpl();
>       Naming.rebind("///" + server, rsi);
>     }
>     catch (java.rmi.ConnectException exc) {
>       System.err.println("Please run rmiregistry first.");
>       System.exit(-2);
>     }
>     catch (MalformedURLException exc) {
>       System.err.println("Error binding server; try a different name.");
>       System.exit(-3);
>     }
>     catch (RemoteException exc) {
>       System.err.println("Error binding server:");
>       exc.printStackTrace();
>       System.exit(-4);
>     }
>     rsi.addDataReference(ref);

can be rewritten as:

      System.out.println("Starting remote server...");
      RemoteServerImpl rsi;
      try {
        visad.util.ClientServer.startServer(server);
      }
      catch (Exception exc) {
        System.err.println("Error creating server:");
        exc.printStackTrace();
        System.exit(-1);
        return;
      }
      rsi.addDataReference(ref);

In addition to being a bit shorter, this code will
automatically start an 'rmiregistry' server if one is not
yet running.


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: