Lucene.Net.Store.NativeFSLock.Release C# (CSharp) Method

Release() public method

public Release ( ) : void
return void
        public override void Release()
        {
            lock (this)
            {
                if (Channel != null)
                {
                    try
                    {
                        Channel.Unlock(0, Channel.Length);

                        NativeFSLock _;
                        _creatingInstance._locks.TryRemove(Path.FullName, out _);
                    }
                    finally
                    {
                        IOUtils.CloseWhileHandlingException(Channel);
                        Channel = null;
                    }

                    bool tmpBool;
                    if (File.Exists(Path.FullName))
                    {
                        File.Delete(Path.FullName);
                        tmpBool = true;
                    }
                    else if (System.IO.Directory.Exists(Path.FullName))
                    {
                        System.IO.Directory.Delete(Path.FullName);
                        tmpBool = true;
                    }
                    else
                    {
                        tmpBool = false;
                    }
                    if (!tmpBool)
                    {
                        throw new LockReleaseFailedException("failed to delete " + Path);
                    }
                }
            }
        }