Make EditSession closeable for easy flushing

This commit is contained in:
Kenzie Togami
2018-10-20 19:50:35 -07:00
parent 1fa1ff895b
commit a3f1c71d97
6 changed files with 69 additions and 64 deletions

View File

@ -134,7 +134,7 @@ import javax.annotation.Nullable;
* using the {@link ChangeSetExtent}.</p>
*/
@SuppressWarnings({"FieldCanBeLocal"})
public class EditSession implements Extent {
public class EditSession implements Extent, AutoCloseable {
private static final Logger log = Logger.getLogger(EditSession.class.getCanonicalName());
@ -636,6 +636,14 @@ public class EditSession implements Extent {
return bypassNone.getEntities();
}
/**
* Closing an EditSession {@linkplain #flushSession() flushes its buffers}.
*/
@Override
public void close() {
flushSession();
}
/**
* Communicate to the EditSession that all block changes are complete,
* and that it should apply them to the world.