Example #1
0
 private void buildFromHostString(String hostString) {
   this.clientId = new RPubClientId(RPubUtil.parseRPubClientId(hostString));
   this.hostName = RPubUtil.parseRPubHostName(hostString);
   this.domain = RPubUtil.parseRPubHostDomain(hostString);
   this.port = RPubUtil.parseRPubHostPort(hostString);
   this.maxByteIn = RPubUtil.kiloBytesToBytes(RPubUtil.parseRPubHostKByteIn(hostString));
   this.maxByteOut = RPubUtil.kiloBytesToBytes(RPubUtil.parseRPubHostKByteOut(hostString));
 }
Example #2
0
  /**
   * Load RPubHostInfo by decoding the props file
   *
   * @param hostId Host ID as defined in the props file
   */
  public RPubHostInfo(int hostId) {

    // Check through all raw servers and pooled servers
    Properties props = PropertyManager.getProperties(Client.DEFAULT_CONFIG_FILE);
    String rawServers =
        StringUtils.strip(props.getProperty("network.rpub.dynamoth.initial_servers"));
    String rawPoolServers =
        StringUtils.strip(props.getProperty("network.rpub.dynamoth.pool_servers"));
    String rawAllServers = rawServers + ";" + rawPoolServers;

    for (String server : rawAllServers.split(";")) {
      // Parse ID
      int id = RPubUtil.parseRPubClientId(server);

      // If id matches ID in constructor
      if (id == hostId) {

        // Build using this string
        buildFromHostString(server);
        break;
      }
    }
  }