/** Recover a base storage DatasetGraph */ public static void recovery(DatasetGraphTDB dsg) { if ( dsg.getLocation().isMem() ) return ; // Do we need to recover? Journal journal = findJournal(dsg) ; if ( journal == null || journal.isEmpty() ) return ; recoverFromJournal(dsg.getConfig(), journal) ; journal.close(); // Recovery complete. Tidy up. Node journal files have already been handled. if ( journal.getFilename() != null ) { if ( FileOps.exists(journal.getFilename()) ) FileOps.delete(journal.getFilename()) ; } }
/** Stop managing a location. Use with great care (testing only). */ public static synchronized void expel(Location location, boolean force) { StoreConnection sConn = cache.get(location) ; if (sConn == null) return ; if (!force && sConn.transactionManager.activeTransactions()) throw new TDBTransactionException("Can't expel: Active transactions for location: " + location) ; // No transactions at this point (or we don't care and are clearing up forcefully.) sConn.transactionManager.closedown() ; sConn.baseDSG.close() ; sConn.isValid = false ; cache.remove(location) ; ChannelManager.release(sConn.transactionManager.getJournal().getFilename()) ; // Release the lock if (SystemTDB.DiskLocationMultiJvmUsagePrevention) { if (location.getLock().isOwned()) { location.getLock().release(); } else if (location.getLock().canLock()) { SystemTDB.errlog.warn("Location " + location.getDirectoryPath() + " was not locked, if another JVM accessed this location simultaneously data corruption may have occurred"); } } }