1818
1919package com .mongodb ;
2020
21+ import com .mongodb .impl .*;
22+
2123import java .net .*;
2224
2325/**
@@ -41,66 +43,66 @@ public void reset(){
4143 w = 0 ;
4244 wtimeout = 0 ;
4345 fsync = false ;
46+ dbCallbackFactory = DBCallbackImpl .FACTORY ;
4447 }
4548
46-
4749 /**
48- * Helper method to return the appropriate WriteConcern instance based
50+ * Helper method to return the appropriate WriteConcern instance based
4951 * on the current related options settings.
5052 **/
5153 public WriteConcern getWriteConcern (){
5254 // Ensure we only set writeconcern once; if non-default w, etc skip safe (implied)
53- if ( w != 0 || wtimeout != 0 || fsync )
55+ if ( w != 0 || wtimeout != 0 || fsync )
5456 return new WriteConcern ( w , wtimeout , fsync );
55- else if (safe )
57+ else if (safe )
5658 return WriteConcern .SAFE ;
5759 else
5860 return WriteConcern .NORMAL ;
5961 }
6062
6163 /**
62- * <p>The number of connections allowed per host
64+ * <p>The number of connections allowed per host
6365 * (the pool size, per host)</p>
64- * <p>Once the pool is exhausted, this will block.
66+ * <p>Once the pool is exhausted, this will block.
6567 * @see {@linkplain MongoOptions#threadsAllowedToBlockForConnectionMultiplier}</p>
6668 */
6769 public int connectionsPerHost ;
6870
6971 /**
70- * multiplier for connectionsPerHost for # of threads that
72+ * multiplier for connectionsPerHost for # of threads that
7173 * can block if connectionsPerHost is 10, and
72- * threadsAllowedToBlockForConnectionMultiplier is 5,
74+ * threadsAllowedToBlockForConnectionMultiplier is 5,
7375 * then 50 threads can block
7476 * more than that and an exception will be throw
7577 */
7678 public int threadsAllowedToBlockForConnectionMultiplier ;
77-
79+
7880 /**
7981 * The max wait time for a blocking thread for a connection from the pool in ms.
8082 */
8183 public int maxWaitTime ;
8284
8385 /**
84- * The connection timeout in milliseconds; this is for
86+ * The connection timeout in milliseconds; this is for
8587 * establishing the socket connections (open).
8688 * 0 is default and infinite
8789 */
8890 public int connectTimeout ;
8991
9092 /**
91- * The socket timeout; this value is passed to
92- * {@link java.net.Socket#setSoTimeout(int)}.
93+ * The socket timeout; this value is passed to
94+ * {@link java.net.Socket#setSoTimeout(int)}.
9395 * 0 is default and infinite
9496 */
9597 public int socketTimeout ;
96-
98+
9799 /**
98100 * This controls whether the system retries automatically
99- * on connection errors.
101+ * on connection errors.
100102 * defaults to false
101103 */
102104 public boolean autoConnectRetry ;
103-
105+
104106 /**
105107 * Specifies if the driver is allowed to read from secondaries
106108 * or slaves.
@@ -109,26 +111,32 @@ else if (safe)
109111 */
110112 public boolean slaveOk ;
111113
114+ /**
115+ * Override the DBCallback factory. Default is for the standard Mongo Java
116+ * driver configuration.
117+ */
118+ public DBCallbackFactory dbCallbackFactory ;
119+
112120 /**
113121 * If <b>true</b> the driver sends a getLastError command after
114122 * every update to ensure it succeeded (see also w and wtimeout)
115- * If <b>false</b>, the driver does not send a getlasterror command
123+ * If <b>false</b>, the driver does not send a getlasterror command
116124 * after every update.
117125 *
118126 * defaults to false
119127 */
120128 public boolean safe ;
121129
122130 /**
123- * If set, the w value of WriteConcern for the connection is set
131+ * If set, the w value of WriteConcern for the connection is set
124132 * to this.
125133 *
126134 * Defaults to 0; implies safe = true
127135 */
128136 public int w ;
129137
130138 /**
131- * If set, the wtimeout value of WriteConcern for the
139+ * If set, the wtimeout value of WriteConcern for the
132140 * connection is set to this.
133141 *
134142 * Defaults to 0; implies safe = true
@@ -142,7 +150,6 @@ else if (safe)
142150 */
143151 public boolean fsync ;
144152
145-
146153 public String toString (){
147154 StringBuilder buf = new StringBuilder ();
148155 buf .append ( "connectionsPerHost: " ).append ( connectionsPerHost ).append ( " " );
@@ -159,5 +166,5 @@ public String toString(){
159166
160167 return buf .toString ();
161168 }
162-
169+
163170}
0 commit comments