Ejemplo n.º 1
0
 /**
  * ***************************************************************
  *
  * @param ip
  * @param port
  * @return
  */
 public ChordMessageInterface rmiChord(String ip, int port) {
   ChordMessageInterface chord = null;
   try {
     Registry registry = LocateRegistry.getRegistry(ip, port);
     chord = (ChordMessageInterface) (registry.lookup("Chord"));
     return chord;
   } catch (RemoteException e) {
     e.printStackTrace();
   } catch (NotBoundException e) {
     e.printStackTrace();
   }
   return null;
 }
Ejemplo n.º 2
0
  public static void main(String args[]) {
    try {
      String serverName = args[0];

      Solver solver = new Solver();
      String rmiObServer = "rmi://" + HOST + "/" + serverName;
      Naming.rebind(rmiObServer, solver);
      System.out.println("Server ready");
    } catch (ArrayIndexOutOfBoundsException ex) {
      System.out.println("Error! E' necessario specificare il nome del server");
    } catch (RemoteException r) {
      System.out.println("Error while rebind object");
      r.printStackTrace();
      System.exit(1);
    } catch (MalformedURLException m) {
      System.out.println("Error! Malformed url require");
    }
  }