Factor in delay for db process start and client connect
bertramn opened this issue · 0 comments
bertramn commented
When running a test, it always takes a little time for the db to start so the client can connect. Without a delay the mongo driver will spew these errors:
2017-03-16T16:18:50,404 [cluster-ClusterId{value='58ca2e354bbb615b04de3036', description='null'}-localhost:27099] [] INFO o.m.d.cluster Exception in monitor thread while connecting to server localhost:27099
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongo-java-driver-3.0.3.jar:?]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) ~[mongo-java-driver-3.0.3.jar:?]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:141) [mongo-java-driver-3.0.3.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_92]
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[?:1.8.0_92]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[?:1.8.0_92]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_92]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_92]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_92]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[?:1.8.0_92]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_92]
at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_92]
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) ~[mongo-java-driver-3.0.3.jar:?]
at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongo-java-driver-3.0.3.jar:?]
... 3 more