Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/459#discussion_r209422526
  
    --- 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 --
    
    Good point.
    
    Added `if ( locContainer != null )` -- it might be null if passing in a 
`DatasetGraphTDB` (an unusual, internal case).
    
    `locStorage` is not null.  Even in-memory have a `Location`.
    
    As it says "Use with great care"!


---

Reply via email to