Skip to content

Commit 3eae785

Browse files
committed
- JAVA-425: further cleanup
1 parent 2af86e3 commit 3eae785

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

src/main/com/mongodb/DBApiLayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ protected WriteResult insert(DBObject[] arr, boolean shouldApply , com.mongodb.W
243243
OutMessage om = new OutMessage( _mongo , 2002, encoder );
244244

245245
int flags = 0;
246-
if ( concern.continueOnErrorForInsert() ) flags |= 1;
246+
if ( concern.getContinueOnErrorForInsert() ) flags |= 1;
247247
om.writeInt( flags );
248248
om.writeCString( _fullNameSpace );
249249

src/main/com/mongodb/WriteConcern.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,14 @@ public boolean getFsync(){
269269
return _fsync;
270270
}
271271

272-
/**
273-
* Returns whether (batch) inserts will continue if an error occurs before the end
274-
* @return boolean
275-
*/
276-
public boolean continueOnErrorForInsert(){
277-
return _continueOnErrorInsert;
272+
/**
273+
* Gets the fsync flag (fsync to disk on the server)
274+
* @return
275+
*/
276+
public boolean fsync(){
277+
return _fsync;
278278
}
279-
280-
279+
281280
/**
282281
* Returns whether network error may be raised (w >= 0)
283282
* @return
@@ -326,7 +325,7 @@ public static WriteConcern valueOf(String name) {
326325

327326
@Override
328327
public String toString(){
329-
return "WriteConcern " + getCommand() + " / (Continue Inserting on Errors? " + getContinueOnErrorInsert() + ")";
328+
return "WriteConcern " + getCommand() + " / (Continue Inserting on Errors? " + getContinueOnErrorForInsert() + ")";
330329
}
331330

332331
@Override
@@ -335,7 +334,7 @@ public boolean equals( Object o ){
335334
if ( o == null || getClass() != o.getClass() ) return false;
336335

337336
WriteConcern that = (WriteConcern) o;
338-
return _fsync == that._fsync && _wValue == that._wValue && _wtimeout == that._wtimeout && _j == that._j && _continueOnErrorInsert == that._continueOnErrorInsert;
337+
return _fsync == that._fsync && _wValue == that._wValue && _wtimeout == that._wtimeout && _j == that._j && _continueOnErrorForInsert == that._continueOnErrorForInsert;
339338
}
340339

341340
/**
@@ -356,18 +355,18 @@ public boolean getJ() {
356355

357356
/**
358357
* Sets the "continue inserts on error" mode
359-
* @param continueOnErrorInsert
358+
* @param continueOnErrorForInsert
360359
*/
361-
public void setContinueOnErrorInsert(boolean continueOnErrorInsert) {
362-
this._continueOnErrorInsert = continueOnErrorInsert;
360+
public void setContinueOnErrorForInsert(boolean continueOnErrorForInsert) {
361+
this._continueOnErrorForInsert = continueOnErrorForInsert;
363362
}
364363

365364
/**
366365
* Gets the "continue inserts on error" mode
367366
* @return
368367
*/
369-
public boolean getContinueOnErrorInsert() {
370-
return _continueOnErrorInsert;
368+
public boolean getContinueOnErrorForInsert() {
369+
return _continueOnErrorForInsert;
371370
}
372371

373372
/**
@@ -387,7 +386,7 @@ public static Majority majorityWriteConcern( int wtimeout, boolean fsync, boolea
387386
int _wtimeout = 0;
388387
boolean _fsync = false;
389388
boolean _j = false;
390-
boolean _continueOnErrorInsert = false;
389+
boolean _continueOnErrorForInsert = false;
391390

392391
public static class Majority extends WriteConcern {
393392

src/test/com/mongodb/DBCollectionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public void testMultiInsertNoContinue() {
242242
WriteResult r = c.insert(inserted1,inserted2, inserted3);
243243
System.err.println( "Count: " + c.count() + " WriteConcern: " + c.getWriteConcern() );
244244

245-
System.err.println( " Continue on Error? " + c.getWriteConcern().continueOnErrorForInsert() );
245+
System.err.println( " Continue on Error? " + c.getWriteConcern().getContinueOnErrorForInsert() );
246246
for (DBObject doc : c.find( )) {
247247
System.err.println( doc );
248248
}
@@ -271,7 +271,7 @@ public void testMultiInsertWithContinue() {
271271
DBObject inserted2 = BasicDBObjectBuilder.start("_id", id).add("x",3).add("y",4).get();
272272
DBObject inserted3 = BasicDBObjectBuilder.start().add("x",5).add("y",6).get();
273273
WriteConcern wc = new WriteConcern();
274-
wc.setContinueOnErrorInsert(true);
274+
wc.setContinueOnErrorForInsert(true);
275275
WriteResult r = c.insert(wc, inserted1, inserted2, inserted3);
276276
assertEquals( c.count(), 2 );
277277
}

0 commit comments

Comments
 (0)