Code example for FileLock

Methods: release

0
    { 
        // runningLock is held for the lifetime of this process, indicating that 
        // this server has completed startup. 
        try { 
            runningLock = lockChannel.lock(STARTING, RUNNING - STARTING, false);
            notYetRunningLock.release();
        } 
        catch (IOException e) {
            throw new RuntimeException("Cannot lock pid file: " + e);
        } 
 
        notYetRunningLock = null;
    } 
 
    @Override 
    public PidStatus getStatus() 
    { 
        FileLock fileLock;
        try { 
            fileLock = lockChannel.tryLock(STARTING, NOT_YET_RUNNING - STARTING, true);
Experience pair programming with AI  Get Codota for Java