use of com.tencent.tinker.loader.TinkerRuntimeException in project tinker by Tencent.
the class SharePatchInfo method rewritePatchInfoFileWithLock.
public static boolean rewritePatchInfoFileWithLock(File pathInfoFile, SharePatchInfo info, File lockFile) {
if (pathInfoFile == null || info == null || lockFile == null) {
return false;
}
File lockParentFile = lockFile.getParentFile();
if (!lockParentFile.exists()) {
lockParentFile.mkdirs();
}
boolean rewriteSuccess;
ShareFileLockHelper fileLock = null;
try {
fileLock = ShareFileLockHelper.getFileLock(lockFile);
rewriteSuccess = rewritePatchInfoFile(pathInfoFile, info);
} catch (Exception e) {
throw new TinkerRuntimeException("rewritePatchInfoFileWithLock fail", e);
} finally {
try {
if (fileLock != null) {
fileLock.close();
}
} catch (IOException e) {
ShareTinkerLog.i(TAG, "releaseInfoLock error", e);
}
}
return rewriteSuccess;
}
Aggregations