Class SingleInstanceLockFactory


  • public final class SingleInstanceLockFactory
    extends LockFactory
    Implements LockFactory for a single in-process instance, meaning all locking will take place through this one instance. Only use this LockFactory when you are certain all IndexWriters for a given index are running against a single shared in-process Directory instance.
    See Also:
    LockFactory
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.HashSet<java.lang.String> locks  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Lock obtainLock​(Directory dir, java.lang.String lockName)
      Return a new obtained Lock instance identified by lockName.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • locks

        final java.util.HashSet<java.lang.String> locks
    • Constructor Detail

      • SingleInstanceLockFactory

        public SingleInstanceLockFactory()
    • Method Detail

      • obtainLock

        public Lock obtainLock​(Directory dir,
                               java.lang.String lockName)
                        throws java.io.IOException
        Description copied from class: LockFactory
        Return a new obtained Lock instance identified by lockName.
        Specified by:
        obtainLock in class LockFactory
        lockName - name of the lock to be created.
        Throws:
        LockObtainFailedException - (optional specific exception) if the lock could not be obtained because it is currently held elsewhere.
        java.io.IOException - if any i/o error occurs attempting to gain the lock