本文整理了Java中com.mongodb.Mongo.getServerAddressList()
方法的一些代码示例,展示了Mongo.getServerAddressList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mongo.getServerAddressList()
方法的具体详情如下:
包路径:com.mongodb.Mongo
类名称:Mongo
方法名:getServerAddressList
[英]Gets the list of server addresses currently seen by this client. This includes addresses auto-discovered from a replica set.
[中]获取此客户端当前看到的服务器地址列表。这包括从副本集中自动发现的地址。
代码示例来源:origin: Graylog2/graylog2-server
public MongoStats mongoStats() {
final List<ServerAddress> serverAddresses = mongoClient.getServerAddressList();
final List<HostAndPort> servers = Lists.newArrayListWithCapacity(serverAddresses.size());
for (ServerAddress serverAddress : serverAddresses) {
代码示例来源:origin: org.rrd4j/rrd4j
@Override
public List<ServerAddress> servers() {
return rrdCollection.getDB().getMongo().getServerAddressList();
}
@Override
代码示例来源:origin: org.mongeez/mongeez
public MongeezDao(Mongo mongo, String databaseName, MongoAuth auth) {
final List<MongoCredential> credentials = new LinkedList<MongoCredential>();
if (auth != null) {
if (auth.getAuthDb() == null || auth.getAuthDb().equals(databaseName)) {
credentials.add(MongoCredential.createCredential(auth.getUsername(), databaseName, auth.getPassword().toCharArray()));
} else {
credentials.add(MongoCredential.createCredential(auth.getUsername(), auth.getAuthDb(), auth.getPassword().toCharArray()));
}
}
final MongoClient client = new MongoClient(mongo.getServerAddressList(), credentials);
db = client.getDB(databaseName);
configure();
}
代码示例来源:origin: mongeez/mongeez
public MongeezDao(Mongo mongo, String databaseName, MongoAuth auth) {
final List<MongoCredential> credentials = new LinkedList<MongoCredential>();
if (auth != null) {
if (auth.getAuthDb() == null || auth.getAuthDb().equals(databaseName)) {
credentials.add(MongoCredential.createCredential(auth.getUsername(), databaseName, auth.getPassword().toCharArray()));
} else {
credentials.add(MongoCredential.createCredential(auth.getUsername(), auth.getAuthDb(), auth.getPassword().toCharArray()));
}
}
final MongoClient client = new MongoClient(mongo.getServerAddressList(), credentials);
db = client.getDB(databaseName);
configure();
}
代码示例来源:origin: org.rrd4j/rrd4j
rootUri = buildRootUri(db.getName(), rrdCollection.getName(), db.getMongo().getServerAddressList());
代码示例来源:origin: org.graylog2/graylog2-server
public MongoStats mongoStats() {
final List<ServerAddress> serverAddresses = mongoClient.getServerAddressList();
final List<HostAndPort> servers = Lists.newArrayListWithCapacity(serverAddresses.size());
for (ServerAddress serverAddress : serverAddresses) {
内容来源于网络,如有侵权,请联系作者删除!