boolean setLock(String rw, long beginIndex, long bytesNum, boolean s) { if (!this.exists()) return false; try { raf = new RandomAccessFile(this, rw); fc = raf.getChannel(); flk = fc.lock(beginIndex, bytesNum, s); } catch (OverlappingFileLockException oe) { LogUtil.warn("[SetLock]", "[No effect]", "the region has already been locked"); return false; } catch (Exception e) { LogUtil.info("[SetLock]", "[No effect]", e); return false; } return true; }