Skip to content

Commit

Permalink
fix #106
Browse files Browse the repository at this point in the history
  • Loading branch information
anidotnet committed Aug 26, 2018
1 parent 7841eb9 commit d2a4fb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nitrite/src/main/java/org/dizitart/no2/NitriteContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.dizitart.no2.mapper.JacksonMapper;
import org.dizitart.no2.mapper.NitriteMapper;
import org.dizitart.no2.util.ExecutorUtils;
import org.dizitart.no2.util.StringUtils;

import java.util.HashSet;
import java.util.Map;
Expand All @@ -36,6 +37,7 @@
import java.util.concurrent.ScheduledExecutorService;

import static org.dizitart.no2.util.ExecutorUtils.shutdownAndAwaitTermination;
import static org.dizitart.no2.util.ObjectUtils.isObjectStore;

/**
* Represents a readonly view of all contextual information of a nitrite database.
Expand Down Expand Up @@ -174,6 +176,18 @@ public Set<Module> getRegisteredModules() {
return new HashSet<>(jacksonModule);
}

public void dropCollection(String name) {
if (!StringUtils.isNullOrEmpty(name)) {
if (isObjectStore(name)) {
repositoryRegistry.remove(name);
} else {
collectionRegistry.remove(name);
}
}
}



void shutdown() {
shutdownAndAwaitTermination(scheduledWorkerPool, 5);
shutdownAndAwaitTermination(workerPool, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ WriteResultImpl remove(Filter filter, RemoveOptions removeOptions) {
*/
void dropCollection() {
indexingService.dropAllIndices();
nitriteContext.dropCollection(mapStore.getName());
mapStore.getStore().removeMap(mapStore);
}

Expand Down

0 comments on commit d2a4fb6

Please sign in to comment.