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,9 @@ @NotNull @Override public String checkpoint(long lifetime, @NotNull Map properties) { + if (isDisposed.get()) { + throw new IllegalStateException("This DocumentNodeStore is disposed"); + } return checkpoints.create(lifetime, properties).toString(); } @@ -2024,6 +2027,9 @@ @NotNull @Override public String checkpoint(long lifetime) { + if (isDisposed.get()) { + throw new IllegalStateException("This DocumentNodeStore is disposed"); + } Map empty = Collections.emptyMap(); return checkpoint(lifetime, empty); } @@ -2031,6 +2037,9 @@ @NotNull @Override public Map checkpointInfo(@NotNull String checkpoint) { + if (isDisposed.get()) { + throw new IllegalStateException("This DocumentNodeStore is disposed"); + } Revision r = Revision.fromString(checkpoint); Checkpoints.Info info = checkpoints.getCheckpoints().get(r); if (info == null) { @@ -2044,6 +2053,9 @@ @NotNull @Override public Iterable checkpoints() { + if (isDisposed.get()) { + throw new IllegalStateException("This DocumentNodeStore is disposed"); + } final long now = clock.getTime(); return Iterables.transform(Iterables.filter(checkpoints.getCheckpoints().entrySet(), new Predicate>() { @@ -2062,6 +2074,9 @@ @Nullable @Override public NodeState retrieve(@NotNull String checkpoint) { + if (isDisposed.get()) { + throw new IllegalStateException("This DocumentNodeStore is disposed"); + } RevisionVector rv = getCheckpoints().retrieve(checkpoint); if (rv == null) { return null; @@ -2073,6 +2088,9 @@ @Override public boolean release(@NotNull String checkpoint) { + if (isDisposed.get()) { + throw new IllegalStateException("This DocumentNodeStore is disposed"); + } 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) @@ -4043,6 +4043,32 @@ } } + // OAK-9300 + @Test(expected=IllegalStateException.class) + public void createCheckpointAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + store.dispose(); + String ref = store.checkpoint(60000); + } + + // OAK-9300 + @Test(expected=IllegalStateException.class) + public void retrieveCheckpointAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + String ref = store.checkpoint(60000); + store.dispose(); + assertNotNull(store.retrieve(ref)); + } + + // OAK-9300 + @Test(expected=IllegalStateException.class) + public void retrieveCheckpointsAfterDispose() { + DocumentNodeStore store = new DocumentMK.Builder().getNodeStore(); + String ref = store.checkpoint(60000); + store.dispose(); + store.checkpoints(); + } + private void getChildNodeCountTest(int numChildren, Iterable maxValues, Iterable expectedValues)