简体   繁体   中英

mongo db connection time out

The default connection time out is 10 seconds in the mongo java driver . I stopped my mongo instance in my local and same time I am trying to connect mongo db from java .

Currently I am getting time out after 10000 ms exception .

My question is: Is it possible to get connection time out exception before the default time out(10000 ms) ?

Connection Time Out will function in a way that it will wait for the specified time, in your case 10 seconds.

No it is not possible to get the connection time out exception before the specified time.

References:

https://api.mongodb.org/java/2.6/com/mongodb/MongoOptions.html#connectTimeout

How to configure MongoDB Java driver MongoOptions for production use?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM