/** * Unlocks source and copy files after copying content. Also closes the source file so its * content can be deleted if it was deleted. */ private void unlockSourceAndCopy(File sourceFile, File copyFile) { ReadWriteLock sourceLock = sourceFile.contentLock(); if (sourceLock != null) { sourceLock.readLock().unlock(); } ReadWriteLock copyLock = copyFile.contentLock(); if (copyLock != null) { copyLock.writeLock().unlock(); } sourceFile.closed(); }
/** * Unlocks source and copy files after copying content. Also closes the source file so its * content can be deleted if it was deleted. */ private void unlockSourceAndCopy(File sourceFile, File copyFile) { ReadWriteLock sourceLock = sourceFile.contentLock(); if (sourceLock != null) { sourceLock.readLock().unlock(); } ReadWriteLock copyLock = copyFile.contentLock(); if (copyLock != null) { copyLock.writeLock().unlock(); } sourceFile.closed(); }