Skip to content

Commit 6399dd3

Browse files
author
Ryan
committed
documented continue on error better.
1 parent 3eae785 commit 6399dd3

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

src/main/com/mongodb/WriteConcern.java

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/**
2727
* <p>WriteConcern control the write behavior for with various options, as well as exception raising on error conditions.</p>
28-
*
28+
*
2929
* <p>
3030
* <b>w</b>
3131
* <ul>
@@ -41,7 +41,7 @@
4141
* </ul>
4242
* </p>
4343
* <p><b>fsync</b> force fsync to disk </p>
44-
*
44+
*
4545
* @dochub databases
4646
*/
4747
public class WriteConcern {
@@ -51,7 +51,7 @@ public class WriteConcern {
5151

5252
/** Exceptions are raised for network issues, but not server errors */
5353
public final static WriteConcern NORMAL = new WriteConcern(0);
54-
54+
5555
/** Exceptions are raised for network issues, and server errors; waits on a server for the write operation */
5656
public final static WriteConcern SAFE = new WriteConcern(1);
5757

@@ -66,7 +66,7 @@ public class WriteConcern {
6666

6767
/** Exceptions are raised for network issues, and server errors; waits for at least 2 servers for the write operation*/
6868
public final static WriteConcern REPLICAS_SAFE = new WriteConcern(2);
69-
69+
7070
// map of the constants from above for use by fromString
7171
private static Map<String, WriteConcern> _namedConcerns = null;
7272

@@ -76,8 +76,8 @@ public class WriteConcern {
7676
public WriteConcern(){
7777
this(0);
7878
}
79-
80-
/**
79+
80+
/**
8181
* Calls {@link WriteConcern#WriteConcern(int, int, boolean)} with wtimeout=0 and fsync=false
8282
* @param w number of writes
8383
*/
@@ -93,7 +93,7 @@ public WriteConcern( String w ){
9393
this( w , 0 , false, false );
9494
}
9595

96-
/**
96+
/**
9797
* Calls {@link WriteConcern#WriteConcern(int, int, boolean)} with fsync=false
9898
* @param w number of writes
9999
* @param wtimeout timeout for write operation
@@ -109,8 +109,8 @@ public WriteConcern( int w , int wtimeout ){
109109
public WriteConcern( boolean fsync ){
110110
this( 1 , 0 , fsync);
111111
}
112-
113-
/**
112+
113+
/**
114114
* Creates a WriteConcern object.
115115
* <p>Specifies the number of servers to wait for on the write operation, and exception raising behavior </p>
116116
* <p> w represents the number of servers:
@@ -182,7 +182,7 @@ public WriteConcern( String w , int wtimeout , boolean fsync, boolean j ){
182182
public BasicDBObject getCommand(){
183183
BasicDBObject _command = new BasicDBObject( "getlasterror" , 1 );
184184

185-
if ( _wValue instanceof Integer && ( (Integer) _wValue > 0) ||
185+
if ( _wValue instanceof Integer && ( (Integer) _wValue > 0) ||
186186
( _wValue instanceof String && _wValue != null ) ){
187187
_command.put( "w" , _wValue );
188188
_command.put( "wtimeout" , _wtimeout );
@@ -199,36 +199,36 @@ public BasicDBObject getCommand(){
199199

200200
/**
201201
* Sets the w value (the write strategy)
202-
* @param wValue
202+
* @param wValue
203203
*/
204204
public void setWObject(Object wValue) {
205205
this._wValue = wValue;
206206
}
207-
207+
208208
/**
209209
* Gets the w value (the write strategy)
210210
* @return
211211
*/
212212
public Object getWObject(){
213213
return _wValue;
214214
}
215-
215+
216216
/**
217217
* Sets the w value (the write strategy)
218-
* @param w
218+
* @param w
219219
*/
220220
public void setW(int w) {
221221
_wValue = w;
222222
}
223-
223+
224224
/**
225225
* Gets the w parameter (the write strategy)
226226
* @return
227227
*/
228228
public int getW(){
229229
return (Integer) _wValue;
230230
}
231-
231+
232232
/**
233233
* Gets the w parameter (the write strategy) in String format
234234
* @return
@@ -239,7 +239,7 @@ public String getWString(){
239239

240240
/**
241241
* Sets the write timeout (in milliseconds)
242-
* @param wtimeout
242+
* @param wtimeout
243243
*/
244244
public void setWtimeout(int wtimeout) {
245245
this._wtimeout = wtimeout;
@@ -260,23 +260,23 @@ public int getWtimeout(){
260260
public void setFsync(boolean fsync) {
261261
_fsync = fsync;
262262
}
263-
263+
264264
/**
265265
* Gets the fsync flag (fsync to disk on the server)
266266
* @return
267267
*/
268268
public boolean getFsync(){
269269
return _fsync;
270270
}
271-
271+
272272
/**
273273
* Gets the fsync flag (fsync to disk on the server)
274274
* @return
275275
*/
276276
public boolean fsync(){
277277
return _fsync;
278278
}
279-
279+
280280
/**
281281
* Returns whether network error may be raised (w >= 0)
282282
* @return
@@ -347,23 +347,25 @@ public void setJ(boolean j) {
347347

348348
/**
349349
* Gets the j parameter (journal syncing)
350-
* @return
350+
* @return
351351
*/
352352
public boolean getJ() {
353353
return _j;
354354
}
355355

356356
/**
357-
* Sets the "continue inserts on error" mode
358-
* @param continueOnErrorForInsert
357+
* Sets the "continue inserts on error" mode. This only applies to server side errors.
358+
* If there is a document which does not validate in the client, an exception will still
359+
* be thrown in the client.
360+
* @param continueOnErrorForInsert
359361
*/
360362
public void setContinueOnErrorForInsert(boolean continueOnErrorForInsert) {
361363
this._continueOnErrorForInsert = continueOnErrorForInsert;
362364
}
363365

364366
/**
365367
* Gets the "continue inserts on error" mode
366-
* @return
368+
* @return
367369
*/
368370
public boolean getContinueOnErrorForInsert() {
369371
return _continueOnErrorForInsert;

0 commit comments

Comments
 (0)