client/src/main/java/com/orientechnologies/orient/client/remote/OStorageRemote.java
protected void parseServerURLs() {
    String lastHost = null;
    int dbPos = url.indexOf('/');
    if (dbPos == -1) {
      // SHORT FORM
      addHost(url);
      lastHost = url;
      name = url;
    } else {
      name = url.substring(url.lastIndexOf("/") + 1);
      for (String host : url.substring(0, dbPos).split(ADDRESS_SEPARATOR)) {
        lastHost = host;
        addHost(host);
      }
    }

    synchronized (serverURLs) {
      if (serverURLs.size() == 1 && getClientConfiguration()
          .getValueAsBoolean(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_ENABLED)) {
        // LOOK FOR LOAD BALANCING DNS TXT RECORD
        final String primaryServer = lastHost;

        OLogManager.instance().debug(this, "Retrieving URLs from DNS '%s' (timeout=%d)...", primaryServer,
            getClientConfiguration().getValueAsInteger(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT));

        try {
          final Hashtable<String, String> env = new Hashtable<String, String>();
          env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
          env.put("com.sun.jndi.ldap.connect.timeout",
              getClientConfiguration().getValueAsString(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT));

          final DirContext ictx = new InitialDirContext(env);
          final String hostName = !primaryServer.contains(":") ?
              primaryServer :
              primaryServer.substring(0, primaryServer.indexOf(":"));
          final Attributes attrs = ictx.getAttributes(hostName, new String[] { "TXT" });
          final Attribute attr = attrs.get("TXT");
          if (attr != null) {
            for (int i = 0; i < attr.size(); ++i) {
              String configuration = (String) attr.get(i);
              if (configuration.startsWith("\""))
                configuration = configuration.substring(1, configuration.length() - 1);
              if (configuration != null) {
                final String[] parts = configuration.split(" ");
                List<String> toAdd = new ArrayList<>();
                for (String part : parts) {
                  if (part.startsWith("s=")) {
                    toAdd.add(part.substring("s=".length()));
                  }
                }
                if (toAdd.size() > 0) {
                  serverURLs.clear();
                  for (String host : toAdd)
                    addHost(host);
                }
              }
            }
          }
        } catch (NamingException ignore) {
        }
      }
    }
  }
protected void parseServerURLs() {
    String lastHost = null;
    int dbPos = url.indexOf('/');
    if (dbPos == -1) {
      // SHORT FORM
      addHost(url);
      lastHost = url;
      name = url;
    } else {
      name = url.substring(url.lastIndexOf("/") + 1);
      for (String host : url.substring(0, dbPos).split(ADDRESS_SEPARATOR)) {
        lastHost = host;
        addHost(host);
      }
    }

    synchronized (serverURLs) {
      if (serverURLs.size() == 1 && getClientConfiguration()
          .getValueAsBoolean(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_ENABLED)) {
        // LOOK FOR LOAD BALANCING DNS TXT RECORD
        final String primaryServer = lastHost;

        OLogManager.instance().debug(this, "Retrieving URLs from DNS '%s' (timeout=%d)...", primaryServer,
            getClientConfiguration().getValueAsInteger(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT));

        try {
          final Hashtable<String, String> env = new Hashtable<String, String>();
          env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
          env.put("com.sun.jndi.ldap.connect.timeout",
              getClientConfiguration().getValueAsString(OGlobalConfiguration.NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT));

          final DirContext ictx = new InitialDirContext(env);
          final String hostName = !primaryServer.contains(":") ?
              primaryServer :
              primaryServer.substring(0, primaryServer.indexOf(":"));
          final Attributes attrs = ictx.getAttributes(hostName, new String[] { "TXT" });
          final Attribute attr = attrs.get("TXT");
          if (attr != null) {
            for (int i = 0; i < attr.size(); ++i) {
              String configuration = (String) attr.get(i);
              if (configuration.startsWith("\""))
                configuration = configuration.substring(1, configuration.length() - 1);
              if (configuration != null) {
                final String[] parts = configuration.split(" ");
                List<String> toAdd = new ArrayList<>();
                for (String part : parts) {
                  if (part.startsWith("s=")) {
                    toAdd.add(part.substring("s=".length()));
                  }
                }
                if (toAdd.size() > 0) {
                  serverURLs.clear();
                  for (String host : toAdd)
                    addHost(host);
                }
              }
            }
          }
        } catch (NamingException ignore) {
        }
      }
    }
  }
protected void parseServerURLs ( ) { String lastHost = null ; int dbPos = url . indexOf ( ' ' ) ; if ( dbPos == - 1 ) { // SHORT FORM addHost ( url ) ; lastHost = url ; name = url ; } else { name = url . substring ( url . lastIndexOf ( "/" ) + 1 ) ; for ( String host : url . substring ( 0 , dbPos ) . split ( ADDRESS_SEPARATOR ) ) { lastHost = host ; addHost ( host ) ; } } synchronized ( serverURLs ) { if ( serverURLs . size ( ) == 1 && getClientConfiguration ( ) . getValueAsBoolean ( OGlobalConfiguration . NETWORK_BINARY_DNS_LOADBALANCING_ENABLED ) ) { // LOOK FOR LOAD BALANCING DNS TXT RECORD final String primaryServer = lastHost ; OLogManager . instance ( ) . debug ( this , "Retrieving URLs from DNS '%s' (timeout=%d)..." , primaryServer , getClientConfiguration ( ) . getValueAsInteger ( OGlobalConfiguration . NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT ) ) ; try { final Hashtable < String , String > env = new Hashtable < String , String > ( ) ; env . put ( "java.naming.factory.initial" , "com.sun.jndi.dns.DnsContextFactory" ) ; env . put ( "com.sun.jndi.ldap.connect.timeout" , getClientConfiguration ( ) . getValueAsString ( OGlobalConfiguration . NETWORK_BINARY_DNS_LOADBALANCING_TIMEOUT ) ) ; final DirContext ictx = new InitialDirContext ( env ) ; final String hostName = ! primaryServer . contains ( ":" ) ? primaryServer : primaryServer . substring ( 0 , primaryServer . indexOf ( ":" ) ) ; final Attributes attrs = ictx . getAttributes ( hostName , new String [ ] { "TXT" } ) ; final Attribute attr = attrs . get ( "TXT" ) ; if ( attr != null ) { for ( int i = 0 ; i < attr . size ( ) ; ++ i ) { String configuration = ( String ) attr . get ( i ) ; if ( configuration . startsWith ( "\"" ) ) configuration = configuration . substring ( 1 , configuration . length ( ) - 1 ) ; if ( configuration != null ) { final String [ ] parts = configuration . split ( " " ) ; List < String > toAdd = new ArrayList <> ( ) ; for ( String part : parts ) { if ( part . startsWith ( "s=" ) ) { toAdd . add ( part . substring ( "s=" . length ( ) ) ) ; } } if ( toAdd . size ( ) > 0 ) { serverURLs . clear ( ) ; for ( String host : toAdd ) addHost ( host ) ; } } } } } catch ( NamingException ignore ) { } } } }
Parse the URLs. Multiple URLs must be separated by semicolon (;)
Parse the URLs . Multiple URLs must be separated by semicolon ( ; )