code: private static String getFullInstanceId(String hostname, String id) {
      String str = hostname == null ? "" : hostname;
      str = str.replace('.', '_');
      str += (id == null ? "" : "-" + id);
      return str;
    }
docs: Gets the full instance id of the concatenation of hostname and the id. The dots in the hostname
  replaced by underscores.
  
  @param hostname the hostname
  @param id the instance id
  @return the full instance id of hostname[:id]