コード例 #1
0
ファイル: CliClient.java プロジェクト: AkihiroSuda/PCheck
  // process a statement of the form: connect hostname/port
  private void executeConnect(CommonTree ast) {
    int portNumber = Integer.parseInt(ast.getChild(1).getText());
    Tree idList = ast.getChild(0);

    StringBuilder hostName = new StringBuilder();
    int idCount = idList.getChildCount();
    for (int idx = 0; idx < idCount; idx++) {
      hostName.append(idList.getChild(idx).getText());
    }

    // disconnect current connection, if any.
    // This is a no-op, if you aren't currently connected.
    CliMain.disconnect();

    // now, connect to the newly specified host name and port
    css_.hostName = hostName.toString();
    css_.thriftPort = portNumber;
    CliMain.connect(css_.hostName, css_.thriftPort);
  }
コード例 #2
0
ファイル: CliClient.java プロジェクト: AkihiroSuda/PCheck
 private void cleanupAndExit() {
   CliMain.disconnect();
   System.exit(0);
 }