Code example for FileLock

Methods: release

0
     * Unlock underlying file. 
     */ 
    public synchronized void unlock() { 
        if (lock != null && --locks == 0) {
            try { 
                lock.release();
            } catch (IOException e) {
                String msg = "I/O error while releasing lock: " + e.getMessage();
                log.warn(msg);
            } 
            lock = null;
 
            if (raf != null) {
                try { 
                    raf.close();
                } catch (IOException e) {
                    String msg = "I/O error while closing file: " + e.getMessage();
                    log.warn(msg);
                } 
            }