18
18
19
19
package com .mongodb ;
20
20
21
+ import com .mongodb .impl .*;
22
+
21
23
import java .net .*;
22
24
23
25
/**
@@ -41,66 +43,66 @@ public void reset(){
41
43
w = 0 ;
42
44
wtimeout = 0 ;
43
45
fsync = false ;
46
+ dbCallbackFactory = DBCallbackImpl .FACTORY ;
44
47
}
45
48
46
-
47
49
/**
48
- * Helper method to return the appropriate WriteConcern instance based
50
+ * Helper method to return the appropriate WriteConcern instance based
49
51
* on the current related options settings.
50
52
**/
51
53
public WriteConcern getWriteConcern (){
52
54
// 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 )
54
56
return new WriteConcern ( w , wtimeout , fsync );
55
- else if (safe )
57
+ else if (safe )
56
58
return WriteConcern .SAFE ;
57
59
else
58
60
return WriteConcern .NORMAL ;
59
61
}
60
62
61
63
/**
62
- * <p>The number of connections allowed per host
64
+ * <p>The number of connections allowed per host
63
65
* (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.
65
67
* @see {@linkplain MongoOptions#threadsAllowedToBlockForConnectionMultiplier}</p>
66
68
*/
67
69
public int connectionsPerHost ;
68
70
69
71
/**
70
- * multiplier for connectionsPerHost for # of threads that
72
+ * multiplier for connectionsPerHost for # of threads that
71
73
* can block if connectionsPerHost is 10, and
72
- * threadsAllowedToBlockForConnectionMultiplier is 5,
74
+ * threadsAllowedToBlockForConnectionMultiplier is 5,
73
75
* then 50 threads can block
74
76
* more than that and an exception will be throw
75
77
*/
76
78
public int threadsAllowedToBlockForConnectionMultiplier ;
77
-
79
+
78
80
/**
79
81
* The max wait time for a blocking thread for a connection from the pool in ms.
80
82
*/
81
83
public int maxWaitTime ;
82
84
83
85
/**
84
- * The connection timeout in milliseconds; this is for
86
+ * The connection timeout in milliseconds; this is for
85
87
* establishing the socket connections (open).
86
88
* 0 is default and infinite
87
89
*/
88
90
public int connectTimeout ;
89
91
90
92
/**
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)}.
93
95
* 0 is default and infinite
94
96
*/
95
97
public int socketTimeout ;
96
-
98
+
97
99
/**
98
100
* This controls whether the system retries automatically
99
- * on connection errors.
101
+ * on connection errors.
100
102
* defaults to false
101
103
*/
102
104
public boolean autoConnectRetry ;
103
-
105
+
104
106
/**
105
107
* Specifies if the driver is allowed to read from secondaries
106
108
* or slaves.
@@ -109,26 +111,32 @@ else if (safe)
109
111
*/
110
112
public boolean slaveOk ;
111
113
114
+ /**
115
+ * Override the DBCallback factory. Default is for the standard Mongo Java
116
+ * driver configuration.
117
+ */
118
+ public DBCallbackFactory dbCallbackFactory ;
119
+
112
120
/**
113
121
* If <b>true</b> the driver sends a getLastError command after
114
122
* 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
116
124
* after every update.
117
125
*
118
126
* defaults to false
119
127
*/
120
128
public boolean safe ;
121
129
122
130
/**
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
124
132
* to this.
125
133
*
126
134
* Defaults to 0; implies safe = true
127
135
*/
128
136
public int w ;
129
137
130
138
/**
131
- * If set, the wtimeout value of WriteConcern for the
139
+ * If set, the wtimeout value of WriteConcern for the
132
140
* connection is set to this.
133
141
*
134
142
* Defaults to 0; implies safe = true
@@ -142,7 +150,6 @@ else if (safe)
142
150
*/
143
151
public boolean fsync ;
144
152
145
-
146
153
public String toString (){
147
154
StringBuilder buf = new StringBuilder ();
148
155
buf .append ( "connectionsPerHost: " ).append ( connectionsPerHost ).append ( " " );
@@ -159,5 +166,5 @@ public String toString(){
159
166
160
167
return buf .toString ();
161
168
}
162
-
169
+
163
170
}
0 commit comments