SingleInstanceLockFactory (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.store, class: SingleInstanceLockFactory

Package org.apache.lucene.store

# Class SingleInstanceLockFactory

java.lang.Object
org.apache.lucene.store.LockFactory
org.apache.lucene.store.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`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SingleInstanceLockFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Lock`
  `obtainLock(Directory dir, 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`

- ## Constructor Details

  - ### SingleInstanceLockFactory

    public SingleInstanceLockFactory()

- ## Method Details

  - ### obtainLock

    public Lock obtainLock(Directory dir, String lockName) throws IOException
    Description copied from class: `LockFactory`
    Return a new obtained Lock instance identified by lockName.
    Specified by:
      `obtainLock` in class `LockFactory`
    Parameters:
      `lockName` - name of the lock to be created.
    Throws:
      `IOException` - if any i/o error occurs attempting to gain the lock