private void readStatisticsLogsClients(
      Integer numOfClients, List<ICreateTable> baseTables, String directory) {

    for (ICreateTable createTable : baseTables) {

      int x = 0;

      while (x < numOfClients) {

        Node node = NetworkConfig.CLIENTS.get(x % NetworkConfig.CLIENTS.size());
        log.info(
            this.getClass(),
            "reading statistics log of client "
                + "c"
                + (x + 1)
                + "-filltable-"
                + createTable.getName()
                + " on node: "
                + node);
        SSHService.retrieveFile(
            log,
            node.getSshConnection(),
            SystemConfig.DIRECTORY_VMSYSTEM + "/logs",
            directory + "",
            "c" + (x + 1) + "-filltable-" + createTable.getName() + ".log");
        x++;
      }
    }
  }
  public void createTable(int numOfClients, ICreateTable createTable) {

    log.info(this.getClass(), "");
    log.info(this.getClass(), "client nodes: " + numOfClients);
    log.info(this.getClass(), "creating table");
    log.info(this.getClass(), "name: " + createTable.getName());
    log.info(this.getClass(), "type: " + createTable.getType());

    Node node = NetworkConfig.CLIENTS.get(0);
    List<String> startupCommand = new ArrayList<String>();
    startupCommand.add("cd /");
    startupCommand.add("cd " + SystemConfig.DIRECTORY_VMSYSTEM);

    //		TableDefinition tableDefinition = DatabaseConfig.getTableDefinition(createTable.getName());

    //		if(tableDefinition == null){
    //			log.info(this.getClass(), "create standard table");
    //			startupCommand.add("nohup java -cp vmsystem.jar de.webdataplatform.client.ClientProcess
    // ccreatetable createtable "+createTable.getName()+" &");
    //
    //		}else{
    log.info(this.getClass(), "create split table");
    startupCommand.add(
        "java -cp vmsystem.jar de.webdataplatform.client.ClientProcess ccreatetable createsplittable "
            + createTable.getName()
            + " "
            + createTable.getNumOfRegions());

    //		}

    log.info(this.getClass(), "starting client:" + node);
    List<String> result = SSHService.sendCommand(log, node.getSshConnection(), startupCommand);

    log.info(this.getClass(), "\n");
  }
  private void stopClients(int numOfClients) {

    int x = 0;

    while (x < numOfClients) {

      Node node = NetworkConfig.CLIENTS.get(x % NetworkConfig.CLIENTS.size());

      log.info(this.getClass(), "stopping client:" + node);

      List<String> stopCommand = new ArrayList<String>();
      stopCommand.add("pkill -9 -f ClientProcess");

      List<String> result = SSHService.sendCommand(log, node.getSshConnection(), stopCommand);
      x++;
    }
    log.info(this.getClass(), "\n");
  }
  public void fillBaseTable(Integer numOfClients, CreateBaseTable createBaseTable) {

    log.info(this.getClass(), "filling base table " + createBaseTable);
    log.info(this.getClass(), "using  " + numOfClients + " client");
    log.info(
        this.getClass(),
        "" + (createBaseTable.getNumOfOperations() / numOfClients) + " operations per client");

    int x = 0;

    //		int messagePort = vmMessagePort;
    while (x < numOfClients) {

      Node node = NetworkConfig.CLIENTS.get(x % NetworkConfig.CLIENTS.size());

      List<String> startupCommand = new ArrayList<String>();
      startupCommand.add("cd /");
      startupCommand.add("cd " + SystemConfig.DIRECTORY_VMSYSTEM);
      startupCommand.add(
          "java -cp vmsystem.jar de.webdataplatform.client.ClientProcess c"
              + (x + 1)
              + " filltable "
              + createBaseTable.getName()
              + " "
              + createBaseTable.getDistribution()
              + " "
              + (createBaseTable.getNumOfOperations() / numOfClients));

      log.info(this.getClass(), "starting client:" + node);
      List<String> result = SSHService.sendCommand(log, node.getSshConnection(), startupCommand);
      x++;
      //			try {
      //				Thread.sleep(2000);
      //			} catch (InterruptedException e) {
      //
      //				e.printStackTrace();
      //			}

    }
    log.info(this.getClass(), "\n");
  }
  public void queueMarkers(List<CreateBaseTable> createTables) {

    Node node = NetworkConfig.CLIENTS.get(0);

    for (CreateBaseTable createTable : createTables) {

      List<String> startupCommand = new ArrayList<String>();
      startupCommand.add("cd /");
      startupCommand.add("cd " + SystemConfig.DIRECTORY_VMSYSTEM);

      log.info(this.getClass(), "queue markers to base table");
      startupCommand.add(
          "java -cp vmsystem.jar de.webdataplatform.client.ClientProcess cqueuemarker queuefinishmarkers "
              + createTable.getName()
              + " "
              + createTable.getNumOfRegions());

      log.info(this.getClass(), "starting client:" + node);
      List<String> result = SSHService.sendCommand(log, node.getSshConnection(), startupCommand);

      log.info(this.getClass(), "\n");
    }
  }