MCPcopy Create free account
hub / github.com/facebook/SoLoader / getOrCreateLockOnDir

Method getOrCreateLockOnDir

java/com/facebook/soloader/SysUtil.java:443–459  ·  view source on GitHub ↗
(File soDirectory, File lockFileName)

Source from the content-addressed store, hash-verified

441 }
442
443 public static @Nullable FileLocker getOrCreateLockOnDir(File soDirectory, File lockFileName)
444 throws IOException {
445 boolean notWritable = false;
446 try {
447 return getFileLocker(lockFileName);
448 } catch (FileNotFoundException e) {
449 notWritable = true;
450 if (!soDirectory.setWritable(true)) {
451 throw e;
452 }
453 return getFileLocker(lockFileName);
454 } finally {
455 if (notWritable && !soDirectory.setWritable(false)) {
456 LogUtil.w(TAG, "error removing " + soDirectory.getCanonicalPath() + " write permission");
457 }
458 }
459 }
460
461 public static FileLocker getFileLocker(File lockFileName) throws IOException {
462 return FileLocker.lock(lockFileName);

Callers 3

prepareMethod · 0.95

Calls 2

getFileLockerMethod · 0.95
wMethod · 0.95

Tested by

no test coverage detected