Class DefaultIndexLockService

  • All Implemented Interfaces:
    IndexLockService

    @LuceneIndependent
    public class DefaultIndexLockService
    extends Object
    implements IndexLockService
    The implementation of IndexLockService which initialises all lock in memory. This is what we need for indexes which are stored locally and are accessed only from this JVM. Please note: EnumSet guarantees iteration order, therefore lock ordering will automatically prevent deadlocks
    Since:
    7.9.0
    • Constructor Detail

      • DefaultIndexLockService

        public DefaultIndexLockService()
    • Method Detail

      • tryLock

        public boolean tryLock​(SearchIndex index,
                               long duration,
                               TimeUnit timeUnit)
        Description copied from interface: IndexLockService
        Tries to acquire a lock on the index in given time limit.
        Specified by:
        tryLock in interface IndexLockService
        Returns:
        true if the lock was successfully acquired
      • tryLock

        public boolean tryLock​(EnumSet<SearchIndex> indices,
                               long duration,
                               TimeUnit timeUnit)
        Description copied from interface: IndexLockService
        Tries to acquire a lock on indices in given time limit. The invocation of this method should work in all-or-nothing way, no partial subset of the locks should be acquired.
        Specified by:
        tryLock in interface IndexLockService
        Returns:
        true if all locks were successfully acquired.
      • lock

        public void lock​(EnumSet<SearchIndex> indices)
        Description copied from interface: IndexLockService
        Blocks to acquire a lock on indices. The invocation of this method should work in all-or-nothing way, no partial subset of the locks should be acquired.
        Specified by:
        lock in interface IndexLockService
      • unlock

        public void unlock​(EnumSet<SearchIndex> indices)
        Description copied from interface: IndexLockService
        Releases the lock held on indices. The invocation of this method should work in all-or-nothing way, no partial subset of the locks should be released.
        Specified by:
        unlock in interface IndexLockService