Пример #1
0
  public static void main(String[] args) {
    String clientName;
    String serverHostName;
    if (args.length < 1) {
      System.out.println("Correct syntax is: client <client name> [server host name]");
      return;
    } else if (args.length == 1) {
      clientName = args[0];
      serverHostName = "";
    } else {
      clientName = args[0];
      serverHostName = args[1];
    }

    try {
      // Creates an active object for the client
      Client theClient =
          org.objectweb.proactive.api.PAActiveObject.newActive(
              Client.class, new Object[] {clientName, serverHostName});
      if (theClient.init()) {
        Thread t = new Thread(new RunClient(theClient));
        t.start();
        t.join();
      }
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
    System.exit(0);
  }