/** * Releases all associated resources like memory or files. But it does not remove them. To * remove the files created in graphhopperLocation you have to call clean(). */ public void close() { if (ghStorage != null) ghStorage.close(); if (locationIndex != null) locationIndex.close(); try { lockFactory.forceRemove(fileLockName, true); } catch (Exception ex) { // silently fail e.g. on Windows where we cannot remove an unreleased native lock } }
@Test public void testForceDelete() { LockFactory instance = createLockFactory(); instance.setLockDir(lockDir); GHLock lock = instance.create("testlock", true); assertTrue(lock.tryLock()); assertTrue(lock.isLocked()); // on windows we cannot forcefully remove an unreleased lock if (Constants.WINDOWS) lock.release(); instance.forceRemove(lock.getName(), true); assertFalse(lock.isLocked()); } }
/** * Releases all associated resources like memory or files. But it does not remove them. To * remove the files created in graphhopperLocation you have to call clean(). */ public void close() { if (ghStorage != null) ghStorage.close(); if (locationIndex != null) locationIndex.close(); try { lockFactory.forceRemove(fileLockName, true); } catch (Exception ex) { // silently fail e.g. on Windows where we cannot remove an unreleased native lock } }
/** * Releases all associated resources like memory or files. But it does not remove them. To * remove the files created in graphhopperLocation you have to call clean(). */ public void close() { if (ghStorage != null) ghStorage.close(); if (locationIndex != null) locationIndex.close(); try { lockFactory.forceRemove(fileLockName, true); } catch (Exception ex) { // silently fail e.g. on Windows where we cannot remove an unreleased native lock } }
/** * Releases all associated resources like memory or files. But it does not remove them. To * remove the files created in graphhopperLocation you have to call clean(). */ public void close() { if (ghStorage != null) ghStorage.close(); if (locationIndex != null) locationIndex.close(); try { lockFactory.forceRemove(fileLockName, true); } catch (Exception ex) { // silently fail e.g. on Windows where we cannot remove an unreleased native lock } }