/** * Gets the list of hosts * * @return the host list */ public List<String> getHosts() { return proxied.getHosts(); }
if (connectionString.isSrvProtocol()) { mode(ClusterConnectionMode.MULTIPLE); srvHost(connectionString.getHosts().get(0)); else if (connectionString.getHosts().size() == 1 && connectionString.getRequiredReplicaSetName() == null) { mode(ClusterConnectionMode.SINGLE) .hosts(singletonList(createServerAddress(connectionString.getHosts().get(0)))); } else { List<ServerAddress> seedList = new ArrayList<ServerAddress>(); for (final String cur : connectionString.getHosts()) { seedList.add(createServerAddress(cur));
/** * Gets the list of hosts * * @return the host list */ public List<String> getHosts() { return proxied.getHosts(); }
/** * Takes the settings from the given {@code ConnectionString} and applies them to the builder * * @param connectionString the connection string containing details of how to connect to MongoDB * @return this */ public Builder applyConnectionString(final ConnectionString connectionString) { wrappedBuilder.applyConnectionString(connectionString); if (connectionString.getHosts().size() == 1) { try { dbPath = URLDecoder.decode(connectionString.getHosts().get(0), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new MongoClientException(format("Connection String contains an invalid host: %s", connectionString.getHosts().get(0))); } } else { throw new MongoClientEmbeddedException(format("Connection String contains invalid hosts: %s", connectionString.getHosts())); } return this; }
if (connectionString.isSrvProtocol()) { mode(ClusterConnectionMode.MULTIPLE); srvHost(connectionString.getHosts().get(0)); else if (connectionString.getHosts().size() == 1 && connectionString.getRequiredReplicaSetName() == null) { mode(ClusterConnectionMode.SINGLE) .hosts(singletonList(createServerAddress(connectionString.getHosts().get(0)))); } else { List<ServerAddress> seedList = new ArrayList<ServerAddress>(); for (final String cur : connectionString.getHosts()) { seedList.add(createServerAddress(cur));