Releases the lock.

@throws Exception if the lock could not be released  for any reason
506238
public void release() throws Exception {
        synchronized (this) {
            if (log.isDebugEnabled()) {
                log.debug("Releasing lock on " + lockFile.getAbsolutePath());
            }
            if (fileLock != null) {
                try {
                    fileLock.release();
                    fileLock = null;
                } catch (Exception e) {
                    throw new Exception("Unable to release locked file: " + lockFile.getAbsolutePath(), e);
                }
                if (fileChannel != null) {
                    try {
                        fileChannel.close();
                    } catch (IOException e) {
                        // ignore
                    }
                    fileChannel = null;
                }
                if (lockFile != null) {
                    if (lockFile.exists()) {
                        lockFile.delete();
                    }
                    lockFile = null;
                }
            }
        }
    }
621514
public function release()
    {
        try {
            $this->lock->release();
        } catch (\Exception $ex) {
            throw new \RuntimeException(
                sprintf(
                    'Releasing the lock failed with the following message: %s',
                    $ex->getMessage()
                ),
                0,
                $ex
            );
        }
    }
836498
def release(self):
        
        lock = vars(self).pop('lock', missing)
        lock is not missing and self._release(lock)
1112449
public void unlock() throws IOException {
        System.runFinalization();
        if (fileLock != null) {
            try {
                fileLock.release();
            } catch (ClosedChannelException e) {
                throw new IOException("Can't close Channel in " + osFile + ".");
            }
            fileLock = null;
        }
    }
127441
protected function release()
    {
        // Call send in non-blocking mode. If the call fails because the queue
        // is full, then the number of locks configured is too large.
        if (!@msg_send($this->queue, 1, "\0", false, false, $errno)) {
            if ($errno === MSG_EAGAIN) {
                throw new SemaphoreException('The semaphore size is larger than the system allows.');
            }

            throw new SemaphoreException('Failed to release the lock.');
        }
    }
576627
public void stop() throws Exception {
    // close all connectors and release all binding ports
    for (Connector connector : mServer.getConnectors()) {
      connector.stop();
    }

    mServer.stop();
  }
701961
public boolean lock() throws Exception {
        synchronized (this) {
            if (fileLock != null) {
                throw new Exception("The lock is already held");
            }
            if (log.isDebugEnabled()) {
                log.debug("Acquiring lock on " + lockFile.getAbsolutePath());
            }
            try {
                fileChannel = new RandomAccessFile(lockFile, "rw").getChannel();
                fileLock = fileChannel.tryLock();
            } catch (OverlappingFileLockException | IOException e) {
                throw new Exception("Exception occurred while trying to get a lock on file: " +
                        lockFile.getAbsolutePath(), e);
            }
            if (fileLock == null) {
                if (fileChannel != null) {
                    try {
                        fileChannel.close();
                    } catch (IOException ie) {
                        // ignore
                    }
                    fileChannel = null;
                }
                return false;
            } else {
                return true;
            }
        }
    }
1142855
public void close() throws Exception {
        this.files.clear();
        this.files = new ArrayList<File>();
        this.iterator = this.files.iterator();
    }
315985
def release_lock():
    """"""
    get_lock.n_lock -= 1
    assert get_lock.n_lock >= 0
    # Only really release lock once all lock requests have ended.
    if get_lock.lock_is_enabled and get_lock.n_lock == 0:
        get_lock.start_time = None
        get_lock.unlocker.unlock()
582875
public void release() throws IOException {
    if(!fs.delete(lockFile, false)) {
      LOG.error("Thread {} could not delete dir lock {} ", threadInfo(), lockFile);
    }
    else {
      LOG.debug("Thread {} Released dir lock {} ", threadInfo(), lockFile);
    }
  }
1064329
def release(self):
        
        try:
            if self._rotateFailed:
                self._close()
        except Exception:
            self.handleError(NullLogRecord())
        finally:
            try:
                if self.stream_lock and not self.stream_lock.closed:
                    unlock(self.stream_lock)
            except Exception:
                self.handleError(NullLogRecord())
            finally:
                # release thread lock
                if Handler:
                    Handler.release(self)
1311629
public synchronized void release() {
        Enumeration ptdE=threadData.keys();
        while( ptdE.hasMoreElements() ) {
            PerThreadData ptd=(PerThreadData)ptdE.nextElement();
            for (int i=ptd.current; i>=0; i--) {
                if( ptd.handlers != null && ptd.handlers[i]!=null )
                    ptd.handlers[i].release();
            }
        }
    }
1037154
public void releaseLock(Object key) {
      ReentrantReadWriteLock lock = getLock(key);
      if (lock.isWriteLockedByCurrentThread()) {
         lock.writeLock().unlock();
         if (trace) log.tracef("WL released for '%s'", key);
      } else {
         lock.readLock().unlock();
         if (trace) log.tracef("RL released for '%s'", key);
      }
   }
543792
public synchronized void release()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "release");

      super.release();

      if (poolManager != null)
      {
         poolManager.release(this);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "release");
   }
634836
@Override
    public void free() {
        try {
        if(hasCoreConnection()) {
            this.getCoreConnection().close();
        }
        this.fireConnectionFreed();
        this.boundThreadId= Thread.currentThread().getId();

    } finally {
        this.setClosed(true);
        // state may be important for State-Listener, so its set after the listener did their work
        setTransactionalData(false);

        // re-opem is not possible
        // this.connection=null;
        this.releaseThreadBinding();
    }

    }
1117472
def release(self):
        """"""
        if not self.acquired:
            raise threading.ThreadError("Unable to release an unacquired"
                                        " lock")
        try:
            self.unlock()
        except IOError:
            self.logger.exception("Could not unlock the acquired lock opened"
                                  " on `%s`", self.path)
        else:
            self.acquired = False
            try:
                self._do_close()
            except IOError:
                self.logger.exception("Could not close the file handle"
                                      " opened on `%s`", self.path)
            else:
                self.logger.log(_utils.BLATHER,
                                "Unlocked and closed file lock open on"
                                " `%s`", self.path)
446232
@Override
    public synchronized void releaseWriteLock(final Lock lock) {
        if (lock == null || lock.name == null || lock.name.isEmpty()) {
            throw new InvalidArgument("lock is invalid");
        }

        locks.remove(lock.name);

        final File writeLock = getWriteLock();
        if (!writeLock.delete()) {
            throw new IllegalStateException(
                    "write lock could not be deleted");
        }
    }