[JAVA-520] There is no way to chack master in java's client api when new Mongo(serverList) Created: 13/Feb/12 Updated: 25/Jun/13 Resolved: 13/Feb/12 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | 2.6.5, 2.7.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | xfc | Assignee: | Jeffrey Yemin |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | api, check, client, java, master, mogodb | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
Issure url:https://jira.mongodb.org/browse/JAVA-519 We just want to check master in starting our web application. A full client code example: public class MongoDataSource { private static Logger log = LoggerFactory.getLogger(MongoDataSource.class); public MongoDataSource(String replicaHosts, String dbName, String writeConcernName, boolean slaveOk,boolean checkMaster){ this.dbName = dbName; public void init() throws UnknownHostException, MongoException { mongo = new Mongo(hosts); if (checkMaster) { db.getCollectionNames(); }} public void destroy() { mongo.close(); }} configuration in spring xml file: |