Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class LockFactory

    Base class for Locking implementation. Directory uses instances of this class to implement locking.

    Lucene uses NativeFSLockFactory by default for FSDirectory-based index directories.

    Special care needs to be taken if you change the locking implementation: First be certain that no writer is in fact writing to the index otherwise you can easily corrupt your index. Be sure to do the LockFactory change on all Lucene instances and clean up all leftover lock files before starting the new configuration for the first time. Different implementations can not work together!

    If you suspect that some LockFactory implementation is not working properly in your environment, you can easily test it by using VerifyingLockFactory, LockVerifyServer and LockStressTest.

    Inheritance
    object
    LockFactory
    FSLockFactory
    NoLockFactory
    SingleInstanceLockFactory
    VerifyingLockFactory
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class LockFactory

    Fields

    m_lockPrefix

    Base class for Locking implementation. Directory uses instances of this class to implement locking.

    Lucene uses NativeFSLockFactory by default for FSDirectory-based index directories.

    Special care needs to be taken if you change the locking implementation: First be certain that no writer is in fact writing to the index otherwise you can easily corrupt your index. Be sure to do the LockFactory change on all Lucene instances and clean up all leftover lock files before starting the new configuration for the first time. Different implementations can not work together!

    If you suspect that some LockFactory implementation is not working properly in your environment, you can easily test it by using VerifyingLockFactory, LockVerifyServer and LockStressTest.

    Declaration
    protected string m_lockPrefix
    Field Value
    Type Description
    string
    See Also
    LockVerifyServer
    LockStressTest
    VerifyingLockFactory

    Properties

    LockPrefix

    Gets or Sets the prefix in use for all locks created in this LockFactory. This is normally called once, when a Directory gets this LockFactory instance. However, you can also call this (after this instance is assigned to a Directory) to override the prefix in use. This is helpful if you're running Lucene on machines that have different mount points for the same shared directory.

    Declaration
    public virtual string LockPrefix { get; set; }
    Property Value
    Type Description
    string
    See Also
    LockVerifyServer
    LockStressTest
    VerifyingLockFactory

    Methods

    ClearLock(string)

    Attempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you are certain this lock is no longer in use.

    Declaration
    public abstract void ClearLock(string lockName)
    Parameters
    Type Name Description
    string lockName

    name of the lock to be cleared.

    See Also
    LockVerifyServer
    LockStressTest
    VerifyingLockFactory

    MakeLock(string)

    Return a new Lock instance identified by lockName.

    Declaration
    public abstract Lock MakeLock(string lockName)
    Parameters
    Type Name Description
    string lockName

    name of the lock to be created.

    Returns
    Type Description
    Lock
    See Also
    LockVerifyServer
    LockStressTest
    VerifyingLockFactory

    See Also

    LockVerifyServer
    LockStressTest
    VerifyingLockFactory
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.