Exemple #1
0
 protected void connectHosts() {
   getCluster().connect(getDialogPanel(), true, 1);
   for (final Host host : getCluster().getHosts()) {
     host.waitOnLoading();
   }
   checkHosts();
 }
Exemple #2
0
  @Override
  protected JComponent getInputPane() {
    final JPanel pane = new JPanel(new SpringLayout());
    final StringBuilder text = new StringBuilder();
    for (final Host host : getCluster().getHosts()) {
      text.append(host.getName());
      text.append(" connecting...\n");
    }
    pane.add(getAnswerPane(text.toString()));

    SpringUtilities.makeCompactGrid(
        pane, 1, 1, // rows, cols
        1, 1, // initX, initY
        1, 1); // xPad, yPad
    return pane;
  }
Exemple #3
0
  /** Checks hosts, if they are connected and if not reconnects them. */
  protected void checkHosts() {
    final StringBuilder text = new StringBuilder();
    boolean pending = false;
    boolean oneFailed = false;
    for (final Host host : getCluster().getHosts()) {
      final String status;
      if (host.getSSH().isConnectionFailed()) {
        status = "failed.";
        oneFailed = true;
      } else if (host.isConnected()) {
        status = "connected.";
      } else {
        pending = true;
        status = "connecting...";
      }
      text.append(host.getName()).append(' ').append(status).append('\n');
    }
    LOG.debug("checkHosts: pending: " + pending + ", one failed: " + oneFailed);
    if (pending) {
      answerPaneSetText(text.toString());
    } else if (oneFailed) {
      printErrorAndRetry(text.toString());
    } else {
      answerPaneSetText(text.toString());
      try {
        Thread.sleep(1000);
      } catch (final InterruptedException ex) {
        Thread.currentThread().interrupt();
      }

      swingUtils.invokeLater(
          new Runnable() {
            @Override
            public void run() {
              buttonClass(nextButton()).pressButton();
            }
          });
    }
  }