Reputation: 421
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) ?
Upvotes: 3
Views: 6018
Reputation: 5466
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?
Upvotes: 2