Index: oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java =================================================================== --- oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java (revision 1885946) +++ oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java (working copy) @@ -2018,6 +2018,7 @@ @NotNull @Override public String checkpoint(long lifetime, @NotNull Map properties) { + checkOpen(); return checkpoints.create(lifetime, properties).toString(); } @@ -2024,6 +2025,7 @@ @NotNull @Override public String checkpoint(long lifetime) { + checkOpen(); Map empty = Collections.emptyMap(); return checkpoint(lifetime, empty); } @@ -2031,6 +2033,7 @@ @NotNull @Override public Map checkpointInfo(@NotNull String checkpoint) { + checkOpen(); Revision r = Revision.fromString(checkpoint); Checkpoints.Info info = checkpoints.getCheckpoints().get(r); if (info == null) { @@ -2044,6 +2047,7 @@ @NotNull @Override public Iterable checkpoints() { + checkOpen(); final long now = clock.getTime(); return Iterables.transform(Iterables.filter(checkpoints.getCheckpoints().entrySet(), new Predicate>() { @@ -2062,6 +2066,7 @@ @Nullable @Override public NodeState retrieve(@NotNull String checkpoint) { + checkOpen(); RevisionVector rv = getCheckpoints().retrieve(checkpoint); if (rv == null) { return null; @@ -2073,6 +2078,7 @@ @Override public boolean release(@NotNull String checkpoint) { + checkOpen(); checkpoints.release(checkpoint); return true; } Index: oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java =================================================================== --- oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java (revision 1885946) +++ oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java (working copy) @@ -122,11 +122,7 @@ import org.hamcrest.number.OrderingComparison; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; +import org.junit.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -4043,6 +4039,54 @@ } } + // Tests for OAK-9300 + @Test + public void createCheckpointAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + store.dispose(); + Assert.assertThrows(IllegalStateException.class, () -> store.checkpoint(60000)); + } + + @Test + public void createCheckpointWithPropertiesAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + store.dispose(); + Assert.assertThrows(IllegalStateException.class, () -> store.checkpoint(60000, Collections.emptyMap())); + } + + @Test + public void retrieveCheckpointInfoAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + String ref = store.checkpoint(60000); + store.dispose(); + Assert.assertThrows(IllegalStateException.class, () -> store.checkpointInfo(ref)); + } + + @Test + public void getCheckpointsAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + String ref = store.checkpoint(60000); + store.dispose(); + Assert.assertThrows(IllegalStateException.class, () -> store.checkpoints()); + } + + @Test + public void retrieveCheckpointAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + String ref = store.checkpoint(60000); + store.dispose(); + Assert.assertThrows(IllegalStateException.class, () -> store.retrieve(ref)); + } + + @Test + public void releaseCheckpointAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + String ref = store.checkpoint(60000); + store.dispose(); + Assert.assertThrows(IllegalStateException.class, () -> store.release(ref)); + } + // End of tests for OAK-9300 + private void getChildNodeCountTest(int numChildren, Iterable maxValues, Iterable expectedValues)