Few small fixes

Dieser Commit ist enthalten in:
Matthew Miller 2018-12-04 20:24:50 +10:00
Ursprung 59f9864ba3
Commit 618cbd2250
2 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -271,10 +271,10 @@ public class EditSession implements Extent, AutoCloseable {
// pkg private for TracedEditSession only, may later become public API // pkg private for TracedEditSession only, may later become public API
boolean commitRequired() { boolean commitRequired() {
if (reorderExtent.commitRequired()) { if (reorderExtent != null && reorderExtent.commitRequired()) {
return true; return true;
} }
if (isBatchingChunks() && chunkBatchingExtent.commitRequired()) { if (chunkBatchingExtent != null && chunkBatchingExtent.commitRequired()) {
return true; return true;
} }
if (fastModeExtent != null && fastModeExtent.commitRequired()) { if (fastModeExtent != null && fastModeExtent.commitRequired()) {
@ -294,7 +294,7 @@ public class EditSession implements Extent, AutoCloseable {
} }
/** /**
* Sets the {@link ReorderMode} of this EditSession. * Sets the {@link ReorderMode} of this EditSession, and flushes the session.
* *
* @param reorderMode The reorder mode * @param reorderMode The reorder mode
*/ */
@ -305,6 +305,8 @@ public class EditSession implements Extent, AutoCloseable {
if (reorderMode == ReorderMode.MULTI_STAGE && reorderExtent == null) { if (reorderMode == ReorderMode.MULTI_STAGE && reorderExtent == null) {
throw new IllegalArgumentException("An EditSession without a reorder extent tried to use it for reordering!"); throw new IllegalArgumentException("An EditSession without a reorder extent tried to use it for reordering!");
} }
flushSession();
this.reorderMode = reorderMode; this.reorderMode = reorderMode;
switch (reorderMode) { switch (reorderMode) {
case MULTI_STAGE: case MULTI_STAGE:

Datei anzeigen

@ -73,7 +73,7 @@ public class ChunkBatchingExtent extends AbstractDelegateExtent {
} }
public boolean commitRequired() { public boolean commitRequired() {
return batches.size() > 0; return enabled && batches.size() > 0;
} }
@Override @Override