Github user kinow commented on a diff in the pull request: https://github.com/apache/jena/pull/459#discussion_r209416586 --- Diff: jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/sys/TDBInternal.java --- @@ -176,6 +176,23 @@ public static synchronized void expel(DatasetGraph dsg) { StoreConnection.internalExpel(locStorage, false); } + /** Stop managing a DatasetGraph. Use with great care. */ + public static synchronized void expel(DatasetGraph dsg, boolean force) { + Location locContainer = null; + Location locStorage = null; + + if ( dsg instanceof DatasetGraphSwitchable ) { + locContainer = ((DatasetGraphSwitchable)dsg).getLocation(); + dsg = ((DatasetGraphSwitchable)dsg).getWrapped(); + } + if ( dsg instanceof DatasetGraphTDB ) + locStorage = ((DatasetGraphTDB)dsg).getLocation(); + --- End diff -- Should we add something like ```java if (locContainer) throw new SomeRuntimeException("Container Location cannot be null"); // NPE when we try to get from cache if null, in `DatabaseConnection.internalExpel` ? ``` And ditto for the `locStorage` ? Otherwise the `ConcurrentHashMap`'s `cache` used will throw a NPE (I think...)
---