Skip to content

Commit 2767058

Browse files
committed
JAVA-1362: Deprecate continueOnError-related methods and constructor in WriteConcern. Users should use InsertOptions.continueOnError() or DBCollection.initializeUnorderedBulkOperation() instead.
1 parent 190fffc commit 2767058

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

src/main/com/mongodb/WriteConcern.java

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,14 @@ public WriteConcern( int w , int wtimeout , boolean fsync , boolean j ){
253253
* @param fsync whether or not to fsync
254254
* @param j whether writes should wait for a journaling group commit
255255
* @param continueOnError if batch writes should continue after the first error
256+
* @deprecated the preferred way to specify continueOnError is to use write methods that explicitly specify the value of this
257+
* property
258+
* @see #WriteConcern(int, int, boolean)
259+
* @see DBCollection#insert(java.util.List, InsertOptions)
260+
* @see InsertOptions#continueOnError(boolean)
261+
* @see DBCollection#initializeUnorderedBulkOperation()
256262
*/
263+
@Deprecated
257264
public WriteConcern( int w , int wtimeout , boolean fsync , boolean j, boolean continueOnError) {
258265
_w = w;
259266
_wtimeout = wtimeout;
@@ -296,8 +303,14 @@ public WriteConcern( String w , int wtimeout , boolean fsync, boolean j ){
296303
* @param fsync whether or not to fsync
297304
* @param j whether writes should wait for a journaling group commit
298305
* @param continueOnError if batched writes should continue after the first error
299-
* @return
306+
* @deprecated the preferred way to specify continueOnError is to use write methods that explicitly specify the value of this
307+
* property
308+
* @see #WriteConcern(String, int, boolean, boolean)
309+
* @see DBCollection#insert(java.util.List, InsertOptions)
310+
* @see InsertOptions#continueOnError(boolean)
311+
* @see DBCollection#initializeUnorderedBulkOperation()
300312
*/
313+
@Deprecated
301314
public WriteConcern( String w , int wtimeout , boolean fsync, boolean j, boolean continueOnError ){
302315
if (w == null) {
303316
throw new IllegalArgumentException("w can not be null");
@@ -531,8 +544,13 @@ public boolean getJ() {
531544
* be thrown in the client.
532545
* This will return a new instance of WriteConcern with your preferred continueOnInsert value
533546
*
534-
* @param continueOnError
547+
* @param continueOnError whether to continue on error after a failure
548+
* @deprecated the preferred way to specify this is to use write methods that explicitly specify the value of this property
549+
* @see DBCollection#insert(java.util.List, InsertOptions)
550+
* @see InsertOptions#continueOnError(boolean)
551+
* @see DBCollection#initializeUnorderedBulkOperation()
535552
*/
553+
@Deprecated
536554
public WriteConcern continueOnError(boolean continueOnError) {
537555
if ( _w instanceof Integer )
538556
return new WriteConcern((Integer) _w, _wtimeout, _fsync, _j, continueOnError);
@@ -546,7 +564,12 @@ else if ( _w instanceof String )
546564
* Gets the "continue inserts on error" mode
547565
*
548566
* @return the continue on error mode
567+
* @deprecated the preferred way to specify this is to use write methods that explicitly specify the value of this property
568+
* @see DBCollection#insert(java.util.List, InsertOptions)
569+
* @see InsertOptions#isContinueOnError()
570+
* @see DBCollection#initializeUnorderedBulkOperation()
549571
*/
572+
@Deprecated
550573
public boolean getContinueOnError() {
551574
return _continueOnError;
552575
}
@@ -557,18 +580,25 @@ public boolean getContinueOnError() {
557580
* be thrown in the client.
558581
* This will return a new instance of WriteConcern with your preferred continueOnInsert value
559582
*
560-
* @param continueOnErrorForInsert
561-
* @deprecated Use continueOnError instead
583+
* @param continueOnErrorForInsert whether to continue on error after a failure
584+
* @deprecated the preferred way to specify this is to use write methods that explicitly specify the value of this property
585+
* @see DBCollection#insert(java.util.List, InsertOptions)
586+
* @see InsertOptions#continueOnError(boolean)
587+
* @see DBCollection#initializeUnorderedBulkOperation()
562588
*/
563589
@Deprecated
564590
public WriteConcern continueOnErrorForInsert(boolean continueOnErrorForInsert) {
565591
return continueOnError(continueOnErrorForInsert);
566592
}
567593

568594
/**
569-
* Gets the "continue inserts on error" mode
570-
* @return
571-
* @deprecated Use getContinueOnError instead
595+
* Gets the "continue inserts on error" mode.
596+
*
597+
* @return whether to continue on error after a failure
598+
* @deprecated the preferred way to specify this is to use write methods that explicitly specify the value of this property
599+
* @see DBCollection#insert(java.util.List, InsertOptions)
600+
* @see InsertOptions#isContinueOnError()
601+
* @see DBCollection#initializeUnorderedBulkOperation()
572602
*/
573603
@Deprecated
574604
public boolean getContinueOnErrorForInsert() {

0 commit comments

Comments
 (0)