示例#1
0
  public static void launch() {
    println("Launching sos test agents");
    try {

      int port =
          config.getIntValue(
              Constants.KERNEL_PORT_NUMBER_KEY, Constants.DEFAULT_KERNEL_PORT_NUMBER);
      String host =
          config.getValue(Constants.KERNEL_HOST_NAME_KEY, Constants.DEFAULT_KERNEL_HOST_NAME);

      ComponentLauncher launcher = new TCPComponentLauncher(host, port, config);
      connect(launcher, new MessageTestAgent(), config);
    } catch (ConnectionException e) {
      sosLogger.fatal("Error connecting agents", e);
      System.exit(-1);
    } catch (InterruptedException e) {
      sosLogger.fatal("Error connecting agents", e);
      System.exit(-1);
    } catch (ComponentConnectionException e) {
      if (e.getMessage() != null && e.getMessage().indexOf("No more agents") < 0)
        sosLogger.fatal(e.getMessage(), e);
      else {
        sosLogger.fatal("No more agents");
      }
      System.exit(-1);
    }
    System.out.println("============================================================");
  }